def _extension_to_export_function(extension, extensions_map):
    r"""
    Simple function that wraps the extensions map indexing and raises
    a user friendly ``ValueError``

    Parameters
    ----------
    extension : `str`
        The string extension with period prefix e.g '.jpg'
    extensions_map : `dict` of `str` -> `callable`
        The extension map that maps extensions to export callables.

    Returns
    -------
    mapping_callable : `callable`
        The callable that performs exporting.

    Raises
    ------
    ValueError
        If ``extensions_map`` does not contain ``extension``. More friendly
        than the ``KeyError`` that would be raised.
    """
    # This just ensures that a sensible, user friendly Exception is raised.
    try:
        return extensions_map[extension]
    except __HOLE__:
        raise ValueError('The output file extension ({}) provided is not '
                         'currently supported.'.format(extension))
dataset/ETHPy150Open menpo/menpo/menpo/io/output/base.py/_extension_to_export_function