docs: def set_network_permission(network_id, usernames, read, write, share,**kwargs):
      """
          Set permissions on a network to a list of users, identifed by
          their usernames. The read flag ('Y' or 'N') sets read access, the write
          flag sets write access. If the read flag is 'N', then there is
          automatically no write access or share access.
      """
  
      user_id = kwargs.get('user_id')
  
      net_i = _get_network(network_id)
  
      #Check if the user is allowed to share this network.
      net_i.check_share_permission(user_id)
  
      #You cannot edit something you cannot see.
      if read == 'N':
          write = 'N'
          share = 'N'
  
      for username in usernames:
  
          user_i = _get_user(username)
  
          #The creator of a network must always have read and write access
          #to their project
          if net_i.created_by == user_i.id:
              raise HydraError("Cannot set permissions on network %s"
                               " for user %s as tis user is the creator." %
                               (network_id, username))
  
          net_i.set_owner(user_i.id, read=read, write=write, share=share)
      db.DBSession.flush()