def _split_rules(rules):
 split = []
 for rule in rules:
  cidr_ip = rule.get('cidr_ip')
  group_name = rule.get('source_group_name')
  group_id = rule.get('source_group_group_id')
  if (cidr_ip and (not isinstance(cidr_ip, string_types))):
   for ip in cidr_ip:
    _rule = rule.copy()
    _rule['cidr_ip'] = ip
    split.append(_rule)
  elif (group_name and (not isinstance(group_name, string_types))):
   for name in group_name:
    _rule = rule.copy()
    _rule['source_group_name'] = name
    split.append(_rule)
  elif (group_id and (not isinstance(group_id, string_types))):
   for _id in group_id:
    _rule = rule.copy()
    _rule['source_group_group_id'] = _id
    split.append(_rule)
  else:
   split.append(rule)
 return split

def _split_rules ( rules ) : split = [ ] for rule in rules : cidr_ip = rule . get ( 'cidr_ip' ) group_name = rule . get ( 'source_group_name' ) group_id = rule . get ( 'source_group_group_id' ) if ( cidr_ip and ( not isinstance ( cidr_ip , string_types ) ) ) : for ip in cidr_ip : _rule = rule . copy ( ) _rule [ 'cidr_ip' ] = ip split . append ( _rule ) elif ( group_name and ( not isinstance ( group_name , string_types ) ) ) : for name in group_name : _rule = rule . copy ( ) _rule [ 'source_group_name' ] = name split . append ( _rule ) elif ( group_id and ( not isinstance ( group_id , string_types ) ) ) : for _id in group_id : _rule = rule . copy ( ) _rule [ 'source_group_group_id' ] = _id split . append ( _rule ) else : split . append ( rule ) return split
split rules with combined grants into individual rules .