How would you implement a function to validate a specific identity document format for Socure identity verification?
For this exercise, validate a US passport represented by a dictionary. It must contain document_type, issuing_country, document_number, and expiration_date; the number must be nine uppercase alphanumeric characters, and the expiration date must use YYYY-MM-DD format and be on or after the supplied reference date.
Function signature: def validate_identity_document(document, today):
Return True only when every rule is satisfied; otherwise return False.
document is a dictionary.document must contain exactly four string fields.document_number must contain exactly nine uppercase letters or digits.expiration_date and today use YYYY-MM-DD format.def validate_identity_document(document, today):