docs: def parse_config(lines, module=None):
      """Parse a config file.
  
      Names referenced within the config file are found within the calling
      scope. For example::
  
          >>> from potpy.configparser import parse_config
          >>> class foo:
          ...     @staticmethod
          ...     def bar():
          ...         pass
          ...
          >>> config = '''
          ... /foo:
          ...     foo.bar
          ... '''
          >>> router = parse_config(config.splitlines())
  
      would find the ``bar`` method of the ``foo`` class, because ``foo`` is in
      the same scope as the call to parse_config.
  
      :param lines: An iterable of configuration lines (an open file object will
          do).
      :param module: Optional. If provided and not None, look for referenced
          names within this object instead of the calling module.
      """
      if module is None:
          module = _calling_scope(2)
      lines = IndentChecker(lines)
      path_router = PathRouter()
      for depth, line in lines:
          if depth > 0:
              raise SyntaxError('unexpected indent')
          name, path, types = parse_path_spec(line)
          if types:
              template_arg = (path, dict(
                  (k, find_object(module, v))
                  for k, v in types.iteritems()
              ))
          else:
              template_arg = path
          handler = read_handler_block(lines, module)
          path_router.add(name, template_arg, handler)
      return path_router