def METHOD_NAME(self, fromty, toty, by):
    code = self._conversion_codes[by]
    _typeconv.METHOD_NAME(self._ptr, fromty._code, toty._code, code)
    # Ensure the types don't die, otherwise they may be recreated with
    # other type codes and pollute the hash table.
    self._types.add(fromty)
    self._types.add(toty)