@classmethod
def extract_root_meta(cls, serializer, resource):
    """
        Calls a `get_root_meta` function on a serializer, if it exists.
        """
    many = False
    if hasattr(serializer, 'child'):
        many = True
        serializer = serializer.child
    data = {}
    if getattr(serializer, 'get_root_meta', None):
        json_api_meta = serializer.get_root_meta(resource, many)
        assert isinstance(json_api_meta, dict
            ), 'get_root_meta must return a dict'
        data.update(json_api_meta)
    return data
