@classmethod
def create_criteria(cls, query):
    """Return a criteria from a dictionary containing a query.

        Query should be a dictionary, keyed by field name. If the value is
        a list, it will be divided into multiple criteria as required.
        """
    criteria = []
    for name, value in query.items():
        if isinstance(value, list):
            for inner_value in value:
                criteria += cls.create_criteria({name: inner_value})
        else:
            criteria.append({'criteria': {'field': name, 'value': value}})
    return criteria or None
