class_docstr: Converter base class to be reused by various converters.
  Converter allows one to convert data from various source types to a particular
  destination type. Each source type needs to register its converter. The
  registration for each source type is valid for all descendants of that type.
docstr: Convert an instance to the destination type using some registered
  converter. Does recursive lookup for base classes, so there's no need
  for explicit registration for derived classes.
  
  Args:
      instance: source instance to convert to the destination type
  Return:
      An instance of the destination type obtained from the source instance
      Raises KeyError, if no suitable converter found
docstr_tok: ["Convert","an","instance","to","the","destination","type","using","some","registered","converter",".","Does","recursive","lookup","for","base","classes",",","so","there","'s","no","need","for","explicit","registration","for","derived","classes",".","Args",":","instance",":","source","instance","to","convert","to","the","destination","type","Return",":","An","instance","of","the","destination","type","obtained","from","the","source","instance","Raises","KeyError",",","if","no","suitable","converter","found"]
code: def convert(cls, instance: Any, *args, **kwargs):
      """
      Convert an instance to the destination type using some registered
      converter. Does recursive lookup for base classes, so there's no need
      for explicit registration for derived classes.
  
      Args:
          instance: source instance to convert to the destination type
      Return:
          An instance of the destination type obtained from the source instance
          Raises KeyError, if no suitable converter found
      """
      instance_type = type(instance)
      converter = cls._lookup_converter(instance_type)
      if converter is None:
          if cls.dst_type is None:  # pyre-ignore[16]
              output_type_str = "itself"
          else:
              output_type_str = cls.dst_type
          raise KeyError(
              f"Could not find converter from {instance_type} to {output_type_str}"
          )
      return converter(instance, *args, **kwargs)
  
file_path: detectron2/projects/DensePose/densepose/converters/base.py
imports: from typing import Any, Tuple, Type
  import torch
label_desc: Use image node_id 4 for calling the BaseConverter obj's underlying member method code with example usage: obj.convert(cls, instance) and returns: converter