docs: def _check_type(name, obj, expected_type):
      """ Raise a TypeError if object is not of expected type """
      if not isinstance(obj, expected_type):
          raise TypeError(
              '"%s" must be an a %s' % (name, expected_type.__name__)
          )