from importlib import import_module


def importFrom(modname, objname, asTuple=False):
    """
    Import `modname` and return reference to `objname` within the module.

    :param modname: (str) the name of a Python module
    :param objname: (str) the name of an object in module `modname`
    :param asTuple: (bool) if True a tuple is returned, otherwise just the object
    :return: (object or (module, object)) depending on `asTuple`
    """

    module = import_module(modname, package=None)
    obj    = getattr(module, objname)
    return ((module, obj) if asTuple else obj)