def _mesh_export_format_from_filename(filename):
    """
    Determine a mesh output format based on a file name.

    Determine a mesh output format based on a file name. This inspects the file extension.

    Parameters
    ----------
    filename: string
        A file name, may start with a full path. Examples: 'brain.obj' or '/home/myuser/export/brain.ply'. If the file extension is not a recognized extension for a supported format, the default format 'obj' is returned.

    Returns
    -------
    format: string
        A string defining a supported mesh output format. One of ('ply', 'obj').

    matched: Boolean
        Whether the file name ended with a known extension. If not, the returned format was chosen because it is the default format.
    """
    if filename.endswith('.ply'):
        return 'ply', True
    elif filename.endswith('.obj'):
        return 'obj', True
    else:
        return 'obj', False