import importlib


def import_task_specific_log_parser(task_name):
    """
    Returns LogParser module for the specific task.

    :param task_name: name of the task
    :type task_name: str
    :return: TaskLogParser
    :rtype: module
    """
    if task_name == 'Pellets_and_Rep_Milk_Task':  # Temporary workaround to function with older files
        task_name = 'Pellets_and_Rep_Milk'
    try:
        return importlib.import_module('.Tasks.' + task_name + '.LogParser', package='openEPhys_DACQ')
    except ModuleNotFoundError:
        print('Task {} LogParser not found. Returning None.'.format(task_name))
        return None