import importlib
import time


def time_algo(call_string, module_name):
    """
    Times the execution of a python call string.
    :param call_string: str string that calls a python module and executes an
    algorithm
    :param module_name: str name of module from which function is called
    :return run_time: float time in seconds required to execute python call
    string
    """

    module = importlib.import_module(module_name)

    start = time.time()
    exec(call_string)
    finish = time.time()
    run_time = finish - start

    return run_time