def is_localhost(hostname):
    """
    Literally checks that specified hostname means local host.
    This function does not perform DNS lookup.
    Use it in combination with `get_localhost`.

    :param hostname: Domain name or IPv4/IPv6 address.
    :return: True if specified host is a local host.
    """
    return hostname in ('localhost', 'localhost.localdomain', '127.0.0.1',
        '::1')
