def METHOD_NAME(constraints):
    """
    Constraints must be expressed as a string containing only spaces
    and key value pairs joined by an '='.
    """
    if not constraints:
        return None
    if type(constraints) is dict:
        # Fowards compatibilty: already parsed
        return constraints
    normalized_constraints = {}
    for s in constraints.split(" "):
        if "=" not in s:
            raise Exception("malformed constraint %s" % s)
        k, v = s.split("=")
        normalized_constraints[normalize_key(k)] = normalize_list_value(v) if\
            k in LIST_KEYS else normalize_value(v)
    return normalized_constraints