def check_field_constraints(passport):
    """
    This function checks the following constraints:
    byr (Birth Year) - four digits; at least 1920 and at most 2002.
    iyr (Issue Year) - four digits; at least 2010 and at most 2020.
    eyr (Expiration Year) - four digits; at least 2020 and at most 2030.
    hgt (Height) - a number followed by either cm or in:
        If cm, the number must be at least 150 and at most 193.
        If in, the number must be at least 59 and at most 76.

    hcl (Hair Color) - a # followed by exactly six characters 0-9 or a-f.
    ecl (Eye Color) - exactly one of: amb blu brn gry grn hzl oth.
    pid (Passport ID) - a nine-digit number, including leading zeroes.
    """
    checked_passport = dict(passport)

    byr_valid = 1920 <= int(passport["byr"]) <= 2002
    iyr_valid = 2010 <= int(passport["iyr"]) <= 2020
    eyr_valid = 2020 <= int(passport["eyr"]) <= 2030

    hgt_valid = False
    if len(passport["hgt"]) > 2:
        hgt_value = int(passport["hgt"][:-2])
        hgt_unit = passport["hgt"][-2:]
        if hgt_unit == "cm":
            hgt_valid = 150 <= hgt_value <= 193
        else:
            hgt_valid = 59 <= hgt_value <= 76

    hcl_valid = (passport["hcl"][0] == "#") \
            and len(passport["hcl"]) == 7
    ecl_valid = passport["ecl"] in ["amb", "blu", "brn", "gry", "grn", "hzl", "oth"]
    pid_valid = len(passport["pid"]) == 9 and passport["pid"].isdigit()

    checked_passport["valid"] = all([byr_valid, iyr_valid, eyr_valid, hgt_valid, hcl_valid, ecl_valid, pid_valid])
    return checked_passport