import six


def get_from_module(identifier, module_params, ignore_case=True):
    """Return object from module.

    Return object with name `identifier` from module with items `module_params`.

    Parameters
    ----------
    identifier: str
        Name of object, e.g. a function, in module.
    module_params: dict
        `dict` of items in module, e.g. `globals()`
    ignore_case: bool
        If `True`, ignore case of `identifier`.

    Returns
    -------
    object
        Object with name `identifier` in module, e.g. a function or class.
    """
    if ignore_case:
        _module_params = dict()
        for key, value in six.iteritems(module_params):
            _module_params[key.lower()] = value
        _identifier = identifier.lower()
    else:
        _module_params = module_params
        _identifier = identifier
    item = _module_params.get(_identifier)
    if not item:
        raise ValueError('Invalid identifier "%s"!' % identifier)
    return item