def _extract_synapse_id_from_query(query):
    m = re.search(r"from\s+(syn\d+)[^\s]", query, re.IGNORECASE)
    if m:
        return m.group(1)
    else:
        raise ValueError("Couldn't extract synapse ID from query: \"%s\"" % query)


#Derived from https://wiki.python.org/moin/PythonDecoratorLibrary#Memoize
An unfortunate hack to pull the synapse ID out of a table query of the
dataset/ETHPy150Open Sage-Bionetworks/synapsePythonClient/synapseclient/utils.py/_extract_synapse_id_from_query