Helper utility to retrieve the callable function associated with a string identifier.

    Args:
        identifier: The identifier. Could be a string or function.
        module_globals: The global objects of the module.
        module_name: The module name

    Returns:
        The callable associated with the identifier.

def get_identifier(identifier, module_globals, module_name):
    """Helper utility to retrieve the callable function associated with a string identifier.

    Args:
        identifier: The identifier. Could be a string or function.
        module_globals: The global objects of the module.
        module_name: The module name

    Returns:
        The callable associated with the identifier.
    """
    if isinstance(identifier, six.string_types):
        fn = module_globals.get(identifier)
        if fn is None:
            raise ValueError('Unknown {}: {}'.format(module_name, identifier))
        return fn
    elif callable(identifier):
        return identifier
    else:
        raise ValueError('Could not interpret identifier')