code: def accessible_organisms(user, orgs):
      
      permission_map = {
          x['organism']: x['permissions']
          for x in user.organismPermissions
          if 'WRITE' in x['permissions'] or
          'READ' in x['permissions'] or
          'ADMINISTRATE' in x['permissions'] or
          user.role == 'ADMIN'
      }
  
      if 'error' in orgs:
          raise Exception("Error received from Apollo server: \"%s\"" % orgs['error'])
  
      return [
          (org['commonName'], org['id'], False)
          for org in sorted(orgs, key=lambda x: x['commonName'])
          if org['commonName'] in permission_map
      ]
docs: Get the list of organisms accessible to a user, filtered by `orgs`