def METHOD_NAME(form, field):
    """
    Raise a StopValidation exception if the supplied field's data is not a valid GSTIN.
    Checks if the data is:
    - 15 characters in length
    - First two characters form a valid short code for an Indian state
    - Contains a PAN (alphanumeric sub-string ranging from the 2nd to the 11th character)
    - Last character is an alphanumeric
    Reference: https://cleartax.in/s/know-your-gstin
    """
    # 15 length, first 2 digits, valid pan, checksum
    if (
        len(field.data) != 15
        or int(field.data[:2]) not in short_codes
        or not field.data[2:12].isalnum()
        or not field.data[-1].isalnum()
    ):
        raise forms.validators.StopValidation(
            __("This does not appear to be a valid GSTIN")
        )