code: def resolve(self, name, version, max_id):
          
          if not isinstance(name, six.text_type):
              raise TypeError('Name must be a Unicode sequence: %r' % name)
          if not isinstance(version, int):
              raise TypeError('Version must be an int: %r' % version)
          if version <= 0:
              raise ValueError('Version must be positive: %s' % version)
          if max_id is not None and max_id < 0:
              raise ValueError('Max ID must be zero or positive: %s' % max_id)
  
          versions = self.__tables.get(name)
          if versions is None:
              if max_id is None:
                  raise CannotSubstituteTable(
                      'Found no table for %s, but no max_id' % name
                  )
              return placeholder_symbol_table(name, version, max_id)
  
          table = versions.get(version)
          if table is None:
              # TODO Replace the keys map with a search tree based dictionary.
              keys = list(versions)
              keys.sort()
              table = versions[keys[-1]]
  
          if table.version == version and (max_id is None or table.max_id == max_id):
              return table
  
          if max_id is None:
              raise CannotSubstituteTable(
                  'Found match for %s, but not version %d, and no max_id' % (name, version)
              )
  
          return substitute_symbol_table(table, version, max_id)
docs: Resolves the table for a given name and version.
  
          Args:
              name (unicode): The name of the table to resolve.
              version (int): The version of the table to resolve.
              max_id (Optional[int]): The maximum ID of the table requested.
                  May be ``None`` in which case an exact match on ``name`` and ``version``
                  is required.
  
          Returns:
              SymbolTable: The *closest* matching symbol table.  This is either an exact match,
              a placeholder, or a derived substitute depending on what tables are registered.