def create_transformer_classes(transformer_spec, config_globals, increment_id):
  """Create an importer and exporter class from a transformer spec.

  Args:
    transformer_spec: A bulkloader_parser.TransformerEntry.
    config_globals: Dict to use to reference globals for code in the config.
    increment_id: Method IncrementId(key) which will increment the
      auto-allocated ids in the datastore beyond the key.id(). Can be None.

  Raises:
    InvalidConfig: when the config is invalid.

  Returns:
    Tuple, (importer class, exporter class), each which is in turn a wrapper
    for the GenericImporter/GenericExporter class using a DictConvertor object
    configured as per the transformer_spec.
  """

  if transformer_spec.connector in CONNECTOR_FACTORIES:
    connector_factory = CONNECTOR_FACTORIES[transformer_spec.connector]
  elif config_globals and '.' in transformer_spec.connector:
    try:
      connector_factory = eval(transformer_spec.connector, config_globals)
    except (__HOLE__, AttributeError):
      raise bulkloader_errors.InvalidConfiguration(
          'Invalid connector specified for name=%s. Could not evaluate %s.' %
          (transformer_spec.name, transformer_spec.connector))
  else:
    raise bulkloader_errors.InvalidConfiguration(
        'Invalid connector specified for name=%s. Must be either a built in '
        'connector ("%s") or a factory method in a module imported via '
        'python_preamble.' %
        (transformer_spec.name, '", "'.join(CONNECTOR_FACTORIES)))
  options = {}
  if transformer_spec.connector_options:
    options = transformer_spec.connector_options.ToDict()

  try:
    connector_object = connector_factory(options, transformer_spec.name)
  except TypeError:


    raise bulkloader_errors.InvalidConfiguration(
        'Invalid connector specified for name=%s. Could not initialize %s.' %
        (transformer_spec.name, transformer_spec.connector))





  dict_to_model_object = DictConvertor(transformer_spec)

  class ImporterClass(GenericImporter):
    """Class to pass to the bulkloader, wraps the specificed configuration."""

    def __init__(self):
      super(self.__class__, self).__init__(
          connector_object.generate_import_record,
          dict_to_model_object.dict_to_entity,
          transformer_spec.name,
          increment_id)
  importer_class = ImporterClass

  class ExporterClass(GenericExporter):
    """Class to pass to the bulkloader, wraps the specificed configuration."""

    def __init__(self):

      super(self.__class__, self).__init__(
          connector_object,
          dict_to_model_object.entity_to_dict,
          transformer_spec.kind,
          transformer_spec.sort_key_from_entity)
  exporter_class = ExporterClass

  return importer_class, exporter_class
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/ext/bulkload/bulkloader_config.py/create_transformer_classes