def expandServices(service_elements):
 expanded = []
 for service_element in service_elements:
  expanded.extend(expandService(service_element))
 return expanded

def expandServices ( service_elements ) : expanded = [ ] for service_element in service_elements : expanded . extend ( expandService ( service_element ) ) return expanded
take a sorted iterator of service elements and expand it into a sorted iterator of: there may be more than one item in the resulting list for each service element if there is more than one uri or type for a service .