Search for reactions

def reactions(columns, n_results, write_db, queries):
    """Search for reactions"""
    if not isinstance(queries, dict):
        query_dict = {}
        for q in queries:
            key, value = q.split('=')
            if key == 'distinct':
                if value in ['True', 'true']:
                    query_dict.update({key: True})
                    continue
            try:
                value = int(value)
                query_dict.update({key: value})
            except BaseException:
                query_dict.update({key: '{0}'.format(value)})
                # Keep {0} in string.format for python2.6 compatibility
    if write_db and n_results > 1000:
        print("""Warning: You're attempting to write more than a 1000 rows
        with geometries. This could take some time""")
    data = query.get_reactions(columns=columns,
                               n_results=n_results,
                               write_db=write_db,
                               **query_dict)

    if write_db:
        return
    table = []
    headers = []
    for row in data['reactions']['edges']:
        table += [list(row['node'].values())]

    headers = list(row['node'].keys())

    print(tabulate(table, headers) + '\n')