def proxy_exception(host, list):
    """Return 1 if host is contained in list or host's suffix matches
    an entry in list that begins with a leading dot."""
    for exception in list:
        if host == exception:
            return 1
        try:
            if exception[0] == '.' and host[-len(exception):] == exception:
                return 1
        except IndexError:
            pass
    return 0