<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def import_related_module(package, pkg_path, related_name, ignore_exceptions=False):
 """Import module from given path."""

    try:
        imp.find_module(related_name, pkg_path)
    except ImportError:
        return

    try:
        return getattr(
            __import__('%s' % (package), globals(), locals(), [related_name]),
            related_name
        )
    except Exception as e:
        if ignore_exceptions:
            current_app.logger.exception(
                'Can not import "{}" package'.format(package)
            )
        else:
            raise e