code: def graph_query(kind, source, target=None, neighbor_limit=1,
                  database_filter=None):
      default_databases = ['wp', 'smpdb', 'reconx', 'reactome', 'psp', 'pid',
                           'panther', 'netpath', 'msigdb', 'mirtarbase', 'kegg',
                           'intact', 'inoh', 'humancyc', 'hprd',
                           'drugbank', 'dip', 'corum']
      if not database_filter:
          query_databases = default_databases
      else:
          query_databases = database_filter
      params = {}
      params['format'] = 'BIOPAX'
      params['organism'] = '9606'
      params['datasource'] = query_databases
      kind_str = kind.lower()
      if kind not in ['neighborhood', 'pathsbetween', 'pathsfromto']:
          logger.warn('Invalid query type %s' % kind_str)
          return None
      params['kind'] = kind_str
      if isinstance(source, basestring):
          source_str = source
      else:
          source_str = ','.join(source)
      params['source'] = source_str
      try:
          neighbor_limit = int(neighbor_limit)
          params['limit'] = neighbor_limit
      except (TypeError, ValueError):
          logger.warn('Invalid neighborhood limit %s' % neighbor_limit)
          return None
      if target is not None:
          if isinstance(target, basestring):
              target_str = target
          else:
              target_str = ','.join(target)
          params['target'] = target_str
      logger.info('Sending Pathway Commons query with parameters: ')
      for k, v in params.items():
          logger.info(' %s: %s' % (k, v))
      logger.info('Sending Pathway Commons query...')
      res = requests.get(pc2_url + 'graph', params=params)
      if not res.status_code == 200:
          logger.error('Response is HTTP code %d.' % res.status_code)
          if res.status_code == 500:
              logger.error('Note: HTTP code 500 can mean empty '
                           'results for a valid query.')
          return None
      model = owl_str_to_model(res.content)
      if model is not None:
          logger.info('Pathway Commons query returned a model...')
      return model