code: def validate_integer(option, value):
      
      if isinstance(value, integer_types):
          return value
      elif isinstance(value, string_type):
          try:
              return int(value)
          except ValueError:
              raise ValueError("The value of %s must be "
                               "an integer" % (option,))
      raise TypeError("Wrong type for %s, value must be an integer" % (option,))
docs: Validates that 'value' is an integer (or basestring representation).