def all_valid(formsets):
 valid = True
 for formset in formsets:
  if (not formset.is_valid()):
   valid = False
 return valid

def all_valid ( formsets ) : valid = True for formset in formsets : if ( not formset . is_valid ( ) ) : valid = False return valid
returns true if every formset in formsets is valid .