from typing import Dict
from typing import Any
from typing import Tuple
from typing import Optional


def source_ip_and_reverse_dns(
        message: Dict[str, Any]) -> Tuple[Optional[str], Optional[str]]:
    """
    Extract the source IP and reverse DNS information from a canary request.
    """
    reverse_dns, source_ip = (None, None)

    if 'SourceIP' in message:
        source_ip = message['SourceIP']
    # `ReverseDNS` can sometimes exist and still be empty.
    if 'ReverseDNS' in message and message['ReverseDNS']:
        reverse_dns = message['ReverseDNS']

    return (source_ip, reverse_dns)