def map_segment_to_hosts(context, segment_id, hosts):
 with db_api.autonested_transaction(context.session):
  for host in hosts:
   network.SegmentHostMapping(context, segment_id=segment_id, host=host).create()

def map_segment_to_hosts ( context , segment_id , hosts ) : with db_api . autonested_transaction ( context . session ) : for host in hosts : network . SegmentHostMapping ( context , segment_id = segment_id , host = host ) . create ( )
map segment to a collection of hosts .