import inspect


def isderivedinstance(instance, parent):
  """
  Test if instance is derived from a parent class.

  Parameters:
    instance  Instance object.
    parent    Class type or string name of the parent class.

  Returns
    True or False.
  """
  try:
    name = parent.__name__
  except AttributeError:
    name = parent
  return name in [c.__name__ for c in inspect.getmro(instance.__class__)]