def _GetTypeFromScope(self, package, type_name, scope):
    if type_name not in scope:
      components = _PrefixWithDot(package).split('.')
      while components:
        possible_match = '.'.join(components + [type_name])
        if possible_match in scope:
          type_name = possible_match
          break
        else:
          components.pop(-1)
    return scope[type_name]
Finds a given type name in the current scope.
dataset/ETHPy150Open sklearn-theano/sklearn-theano/sklearn_theano/externals/google/protobuf/descriptor_pool.py/DescriptorPool._GetTypeFromScope