nodes: 0, module; 1, function_definition; 2, function_name:TypeFactory; 3, parameters; 4, block; 5, identifier:type_; 6, expression_statement; 7, if_statement; 8, for_statement; 9, raise_statement; 10, comment:"""
      This function creates a standard form type from a simplified form.
  
      >>> from datetime import date, datetime
      >>> from pyws.functions.args import TypeFactory
      >>> from pyws.functions.args import String, Integer, Float, Date, DateTime
      >>> TypeFactory(str) == String
      True
      >>> TypeFactory(float) == Float
      True
      >>> TypeFactory(date) == Date
      True
      >>> TypeFactory(datetime) == DateTime
      True
  
      >>> from operator import attrgetter
      >>> from pyws.functions.args import Dict
      >>> dct = TypeFactory({0: 'HelloWorldDict', 'hello': str, 'world': int})
      >>> issubclass(dct, Dict)
      True
      >>> dct.__name__
      'HelloWorldDict'
      >>> fields = sorted(dct.fields, key=attrgetter('name'))
      >>> len(dct.fields)
      2
      >>> fields[0].name == 'hello'
      True
      >>> fields[0].type == String
      True
      >>> fields[1].name == 'world'
      True
      >>> fields[1].type == Integer
      True
  
      >>> from pyws.functions.args import List
      >>> lst = TypeFactory([int])
      >>> issubclass(lst, List)
      True
      >>> lst.__name__
      'IntegerList'
      >>> lst.element_type == Integer
      True
      """; 11, boolean_operator; 12, block; 13, identifier:x; 14, identifier:__types__; 15, block; 16, call; 17, call; 18, call; 19, return_statement; 20, if_statement; 21, identifier:UnknownType; 22, argument_list; 23, identifier:isinstance; 24, argument_list; 25, identifier:issubclass; 26, argument_list; 27, identifier:type_; 28, call; 29, block; 30, identifier:type_; 31, identifier:type_; 32, identifier:type; 33, identifier:type_; 34, identifier:Type; 35, attribute; 36, argument_list; 37, return_statement; 38, identifier:x; 39, identifier:represents; 40, identifier:type_; 41, call; 42, attribute; 43, argument_list; 44, identifier:x; 45, identifier:get; 46, identifier:type_
code: def TypeFactory(type_):
      """
      This function creates a standard form type from a simplified form.
  
      >>> from datetime import date, datetime
      >>> from pyws.functions.args import TypeFactory
      >>> from pyws.functions.args import String, Integer, Float, Date, DateTime
      >>> TypeFactory(str) == String
      True
      >>> TypeFactory(float) == Float
      True
      >>> TypeFactory(date) == Date
      True
      >>> TypeFactory(datetime) == DateTime
      True
  
      >>> from operator import attrgetter
      >>> from pyws.functions.args import Dict
      >>> dct = TypeFactory({0: 'HelloWorldDict', 'hello': str, 'world': int})
      >>> issubclass(dct, Dict)
      True
      >>> dct.__name__
      'HelloWorldDict'
      >>> fields = sorted(dct.fields, key=attrgetter('name'))
      >>> len(dct.fields)
      2
      >>> fields[0].name == 'hello'
      True
      >>> fields[0].type == String
      True
      >>> fields[1].name == 'world'
      True
      >>> fields[1].type == Integer
      True
  
      >>> from pyws.functions.args import List
      >>> lst = TypeFactory([int])
      >>> issubclass(lst, List)
      True
      >>> lst.__name__
      'IntegerList'
      >>> lst.element_type == Integer
      True
      """
      if isinstance(type_, type) and issubclass(type_, Type):
          return type_
      for x in __types__:
          if x.represents(type_):
              return x.get(type_)
      raise UnknownType(type_)