import inspect


def get_unbound_fn(method_or_fn):
  """Return an unbound function from a bound method."""
  if inspect.ismethod(method_or_fn):
    return method_or_fn.__func__
  elif callable(method_or_fn):
    return method_or_fn
  else:
    raise ValueError('Expect a function or method.')