from typing import Callable
import importlib


def get_method(pkg_path: str) -> Callable:
    """
    Returns a method given the full package path of the method, e.g.
    given the string ``oedtools.schema.get_schema`` it will return the
    actual method ``get_schema`` from the ``oedtools.schema`` module.

    :param pkg_path: Full package path of the method
    :type pkg_path: str

    :return: The actual method
    :rtype: function
    """
    path_tokens = pkg_path.split('.')
    return getattr(importlib.import_module('.'.join(path_tokens[:-1])), path_tokens[-1])