from typing import Callable
from typing import Tuple
import inspect


def _get_module_and_name(func: Callable) -> Tuple[str, str]:
  """Gets module and name, or raise error if not a function."""
  if not inspect.isfunction(func) and not inspect.isclass(func):
    raise ValueError('Expect a function or class, but got: {}'.format(func))
  return func.__module__, func.__name__