import importlib


def get_from_module(module, attr_name):
    """ Return a reference from a module.
    The attribute name must exist in the module, it could be a variable,
    a callable or a class.

    If reference name doesn't exists in the module it will return None.

    Example:
    >>> get_from_module("my.module", "my_object")
    >>> get_from_module("my.module", "my_function")
    >>> get_from_module("my.module", "MyClass")

    :param basestring module: The module name.
    :param basestring attr_name: What should be returned from the module.
    :return: The value resolved by the module and attr name provided or None.
    """
    module = importlib.import_module(module)
    try:
        return getattr(module, attr_name)
    except AttributeError:
        return None