code: def CSVofIntegers(msg=None):
      '''
      Checks whether a value is list of integers.
      Returns list of integers or just one integer in
      list if there is only one element in given CSV string.
      '''
      def fn(value):
          try:
              if isinstance(value, basestring):
                  if ',' in value:
                      value = list(map(
                          int, filter(
                              bool, list(map(
                                  lambda x: x.strip(), value.split(',')
                              ))
                          )
                      ))
                      return value
                  else:
                      return [int(value)]
              else:
                  raise ValueError
          except ValueError:
              raise Invalid(
                  '<{0}> is not a valid csv of integers'.format(value)
              )
      return ff CSVofIntegers(msg=None):
      '''
      Checks whether a value is list of integers.
      Returns list of integers or just one integer in
      list if there is only one element in given CSV string.
      '''
      def fn(value):
          try:
              if isinstance(value, basestring):
                  if ',' in value:
                      value = list(map(
                          int, filter(
                              bool, list(map(
                                  lambda x: x.strip(), value.split(',')
                              ))
                          )
                      ))
                      return value
                  else:
                      return [int(value)]
              else:
                  raise ValueError
          except ValueError:
              raise Invalid(
                  '<{0}> is not a valid csv of integers'.format(value)
              )
      return fn
docs: Checks whether a value is list of integers.
      Returns list of integers or just one integer in
      list if there is only one element in given CSV string.