def write_datavalidation(worksheet):
 required_dvs = [x for x in worksheet._data_validations if (len(x.cells) or len(x.ranges))]
 if (not required_dvs):
  return
 dvs = Element('dataValidations', count=str(len(required_dvs)))
 for dv in required_dvs:
  dvs.append(dv.to_tree())
 return dvs

def write_datavalidation ( worksheet ) : required_dvs = [ x for x in worksheet . _data_validations if ( len ( x . cells ) or len ( x . ranges ) ) ] if ( not required_dvs ) : return dvs = Element ( 'dataValidations' , count = str ( len ( required_dvs ) ) ) for dv in required_dvs : dvs . append ( dv . to_tree ( ) ) return dvs
write data validation(s) to xml .