import importlib


def get_simulator_api(api, reload=False):
    """ Get the BioSimulators API for a simulator

    Args:
        api (:obj:`str`): module which implements the API for the simulator
        reload (:obj:`bool`, optional): whether to reload the API

    Returns:
        :obj:`types.ModuleType`
    """
    module = importlib.import_module(api)
    if reload:
        importlib.reload(module)
    return module