def has_fields(passport):

    """
    Check whether all required fields are in the passport.
    """

    for field in ["byr", "iyr", "eyr", "hgt", "hcl", "ecl", "pid"]:
        if not field in passport: return False
    return True