def merge_roles(mop):
 new_list = []
 for m in mop:
  if (m in new_list):
   keep_this = new_list[new_list.index(m)]
   if (not isinstance(keep_this.currentRole, list)):
    keep_this.currentRole = [keep_this.currentRole]
   keep_this.currentRole.append(m.currentRole)
  else:
   new_list.append(m)
 return new_list

def merge_roles ( mop ) : new_list = [ ] for m in mop : if ( m in new_list ) : keep_this = new_list [ new_list . index ( m ) ] if ( not isinstance ( keep_this . currentRole , list ) ) : keep_this . currentRole = [ keep_this . currentRole ] keep_this . currentRole . append ( m . currentRole ) else : new_list . append ( m ) return new_list
merge multiple roles .