import re


def is_from_production_host(entry):
    """
    Return true if a log entry comes from one of our production datacenters

    Handles both string value taken from @source_host or the entire entry from logs

    :type entry str|dict
    :rtype: bool
    """
    if isinstance(entry, str):
        return re.search(r'^(ap|task|cron|job|liftium|staging|deploy|auth|staging-(ap|task))-[sr]', entry) is not None

    # MediaWiki: @fields.environment   prod
    # Kubernetes: kubernetes.namespace_name	       	prod
    return entry.get('@fields', {}).get('environment') in ['prod', 'preview', 'verify'] or \
        entry.get('kubernetes', {}).get('namespace_name') == 'prod'