original_docstring: Checks to see if the number provided is a valid VAT number. This checks
      the length, formatting and check digit.
docstring: Checks to see if the number provided is a valid VAT number. This checks
  the length, formatting and check digit.
docstring_tokens: Checks to see if the number provided is a valid VAT number . This checks the length formatting and check digit .
code: def validate(number):
      """Checks to see if the number provided is a valid VAT number. This checks
      the length, formatting and check digit."""
      number = compact(number)
      if not number[1:-1].isdigit():
          raise InvalidFormat()
      if len(number) != 9:
          raise InvalidLength()
      if number[0].isdigit():
          # natural resident
          dni.validate(number)
      elif number[0] in 'XYZ':
          # foreign natural person
          nie.validate(number)
      else:
          # otherwise it has to be a valid CIF
          cif.validate(number)
      return number
code_tokens: def validate ( number ) : number = compact ( number ) if not number [ 1 : - 1 ] . isdigit ( ) : raise InvalidFormat ( ) if len ( number ) != 9 : raise InvalidLength ( ) if number [ 0 ] . isdigit ( ) : dni . validate ( number ) elif number [ 0 ] in 'XYZ' : nie . validate ( number ) else : cif . validate ( number ) return number
short_docstring: Checks to see if the number provided is a valid VAT number.
short_docstring_tokens: Checks to see if the number provided is a valid VAT number .
comment: """Checks to see if the number provided is a valid VAT number. This checks
      the length, formatting and check digit."""$SEP$# natural resident$SEP$# foreign natural person$SEP$# otherwise it has to be a valid CIF