<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def module_import(module_path):
 """Imports the module indicated in name Args: module_path: string representing a module path such as 'app.config' or 'app.extras.my_module' Returns: the module matching name of the last component, ie: for 'app.extras.my_module' it returns a reference to my_module Raises: BadModulePathError if the module is not found """

    try:
        # Import whole module path.
        module = __import__(module_path)

        # Split into components: ['contour',
        # 'extras','appengine','ndb_persistence'].
        components = module_path.split('.')

        # Starting at the second component, set module to a
        # a reference to that component. at the end
        # module with be the last component. In this case:
        # ndb_persistence
        for component in components[1:]:
            module = getattr(module, component)

        return module

    except ImportError:
        raise BadModulePathError(
            'Unable to find module "%s".' % (module_path,))