import re from datetime import datetime, timedelta from typing import Union def extract_emails(field: str): matches = re.findall(r'([a-zA-Z0-9+._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9_-]+)', field.lower()) return tuple({str(x) for x in matches}) def unix_timestamp_since_to_imap_timestamp(unix_timestamp: Union[int, float]) -> str: return (datetime.fromtimestamp(unix_timestamp) - timedelta(days=1)).strftime("%d-%b-%Y")