def _to_io_meta(shape_meta, valid_keys, key_mappings):
    """
    This is used to make meta data compatible with a specific io
    by filtering and mapping to it's valid keys

    Parameters
    ----------
    shape_meta: dict
        meta attribute of a `regions.Region` object
    valid_keys : python list
        Contains all the valid keys of a particular file format.
    key_mappings : python dict
        Maps to the actual name of the key in the format.

    Returns
    -------
    meta : dict
        io compatible meta dictionary according to valid_keys and key_mappings
    """
    meta = dict()
    for key in shape_meta:
        if key in valid_keys:
            meta[key_mappings.get(key, key)] = shape_meta[key]
    return meta
