def classify_imports(self, chunk):
    """
      Possible import statements:

      import name
      from name import subname
      from name import subname1 as subname2
      from name import *
      from name import tuple

      AST representations:

      ImportFrom:
         module=name
         names=[alias(name, asname), ...]
                    name can be '*'

      Import:
        names=[alias(name, asname), ...]

      Imports are classified into 5 classes:
        stdlib      => Python standard library
        twitter.*   => Twitter internal / standard library
        gen.*       => Thrift gen namespaces
        .*          => Package-local imports
        3rdparty    => site-packages or third party

      classify_imports classifies the import into one of these forms.
    """
    errors = []
    all_module_types = set()
    for node in chunk:
      errors.extend(self.import_errors(node))
      module_types = self.classify_import_node(node)
      if len(module_types) > 1:
        errors.append(self.error(
          'T403',
          'Import statement imports from multiple module types: {types}.'.format(
            types=ImportType.order_names(module_types)),
          node))
      if ImportType.UNKNOWN in module_types:
        errors.append(self.warning('T404', 'Unclassifiable import.', node))
      all_module_types.update(module_types)
    if len(chunk) > 0 and len(all_module_types) > 1:
      errors.append(
          self.error(
            'T405',
            'Import block starting here contains imports '
            'from multiple module types: {types}.'.format(
              types=ImportType.order_names(all_module_types)),
            chunk[0].lineno))
    return all_module_types, errors
Possible import statements:

      import name
      from name import subname
      from name import subname1 as subname2
      from name import *
      from name import tuple

      AST representations:

      ImportFrom:
         module=name
         names=[alias(name, asname), ...]
                    name can be '*'

      Import:
        names=[alias(name, asname), ...]

      Imports are classified into 5 classes:
        stdlib      => Python standard library
        twitter.*   => Twitter internal / standard library
        gen.*       => Thrift gen namespaces
        .*          => Package-local imports
        3rdparty    => site-packages or third party

      classify_imports classifies the import into one of these forms.