def validate_asn(asn):
    """
    Validate the format of a 2-byte or 4-byte autonomous system number

    :param asn: User input of AS number
    :return: Boolean: True if valid format, False if invalid format
    """
    try:
        if "." in str(asn):
            left_asn, right_asn = str(asn).split(".")
            asn_ok = (0 <= int(left_asn) <= 65535) and \
                     (0 <= int(right_asn) <= 65535)
        else:
            asn_ok = 0 <= int(asn) <= 4294967295
    except ValueError:
        asn_ok = False

    return asn_ok