@staticmethod
    def query_dictionary(query, dictionary, delimiter='.'):
        """ Do an xpath-like query with dictionary, using a template if relevant """
        # Based on
        # http://stackoverflow.com/questions/7320319/xpath-like-query-for-nested-python-dictionaries

        try:
            stripped_query = query.strip(delimiter)
            if stripped_query:
                for x in stripped_query.split(delimiter):
                    try:
                        x = int(x)
                        dictionary = dictionary[x]
                    except __HOLE__:
                        dictionary = dictionary[x]
        except:
            return None
        return dictionary
dataset/ETHPy150Open svanoort/pyresttest/pyresttest/validators.py/MiniJsonExtractor.query_dictionary