def METHOD_NAME(payload, fields_must_be_present=None, fields_must_not_be_present=None, error_to_raise=None):
    if not fields_must_be_present:
        fields_must_be_present = []
    if not fields_must_not_be_present:
        fields_must_not_be_present = []
    for f in fields_must_be_present:
        if f not in payload:
            if error_to_raise:
                raise error_to_raise('Invalid JSON. The field {} was missing and is required.'.format(f))
            else:
                return False
    for f in fields_must_not_be_present:
        if f in payload:
            if error_to_raise:
                raise error_to_raise('Invalid JSON. The field {} was present and must not be present.'.format(f))
            else:
                return False
    return True