def build_channels(api_user, nick, channels, path, taxonomy, country=False):
  res = []
  tags = build_tags(channels, taxonomy, path)
  for channel in channels:
    tags = [path, path+'/'+channel]
    if(country):
      rel_ref = Relation(owner='/tag_geo/Global', relation='tags_hierarchical', target=path+'/'+channel)
      rel_ref = rel_ref.put()
      tags.append('/tag_geo/Global')
    description = 'Group P.O.Box for %s' % channel
    try:
      channel_ref = api.channel_create(api_user, nick=nick, channel=channel.title().replace(' ', ''), tags=tags, description=description)
    except exception.ApiException:
      logging.info('Channel Exists')
      nick = api.clean.channel(channel.title().replace(' ', ''))
      query = Actor.gql('WHERE nick=:1', nick)
      channel_ref = query.get()
      if channel_ref:
        if not path in channel_ref.tags:
          channel_ref.tags.append(path)
          channel_key = channel_ref.put()

    res.append(channel_ref)
  logging.info('End Creating Channels')
  return res
dataset/ETHPy150Open CollabQ/CollabQ/administration/actions/country_channels.py/build_channels/original