def split_by_type(activity_references):
 (exploration_ids, collection_ids) = ([], [])
 for activity_reference in activity_references:
  if (activity_reference.type == feconf.ACTIVITY_TYPE_EXPLORATION):
   exploration_ids.append(activity_reference.id)
  elif (activity_reference.type == feconf.ACTIVITY_TYPE_COLLECTION):
   collection_ids.append(activity_reference.id)
  else:
   raise Exception(('Invalid activity reference: (%s, %s)' % (activity_reference.type, activity_reference.id)))
 return (exploration_ids, collection_ids)

def split_by_type ( activity_references ) : ( exploration_ids , collection_ids ) = ( [ ] , [ ] ) for activity_reference in activity_references : if ( activity_reference . type == feconf . ACTIVITY_TYPE_EXPLORATION ) : exploration_ids . append ( activity_reference . id ) elif ( activity_reference . type == feconf . ACTIVITY_TYPE_COLLECTION ) : collection_ids . append ( activity_reference . id ) else : raise Exception ( ( 'Invalid activity reference: (%s, %s)' % ( activity_reference . type , activity_reference . id ) ) ) return ( exploration_ids , collection_ids )
given a list of activity references .