def db_lookup(self):
        """
        Perform an SQL database query

        :return: a dictionary containing the results of the query
        """
        # TODO: Add check to assert if each slot in DStateSys.slots_filled
        # actually exists in the schema.

        DStateSys = self.DSTrackerSys.get_state()

        # Query the database
        cursor = self.database.SQL_connection.cursor()
        sql_command = " SELECT * FROM CamRestaurants "

        args = ''
        prev_arg = False
        for slot in DStateSys.slots_filled:
            if DStateSys.slots_filled[slot] and\
                    DStateSys.slots_filled[slot] != 'dontcare':
                if prev_arg:
                    args += " AND "

                args += slot + " = \"" + DStateSys.slots_filled[slot] + "\""
                prev_arg = True

        if args:
            sql_command += " WHERE " + args + ";"

        cursor.execute(sql_command)
        db_result = cursor.fetchall()

        if db_result:
            # Get the slot names
            slot_names = [i[0] for i in cursor.description]
            result = []
            for db_item in db_result:
                result.append(dict(zip(slot_names, db_item)))

            # Calculate entropy of requestable slot values in results
            entropies = \
                dict.fromkeys(self.ontology.ontology['system_requestable'])
            value_probabilities = {}

            # Count the values
            for req_slot in self.ontology.ontology['system_requestable']:
                value_probabilities[req_slot] = {}

                for db_item in result:
                    if db_item[req_slot] not in value_probabilities[req_slot]:
                        value_probabilities[req_slot][db_item[req_slot]] = 1
                    else:
                        value_probabilities[req_slot][db_item[req_slot]] += 1

            # Calculate probabilities
            for slot in value_probabilities:
                for value in value_probabilities[slot]:
                    value_probabilities[slot][value] /= len(result)

            # Calculate entropies
            for slot in entropies:
                entropies[slot] = 0

                if slot in value_probabilities:
                    for value in value_probabilities[slot]:
                        entropies[slot] +=\
                            value_probabilities[slot][value] * \
                            math.log(value_probabilities[slot][value])

                entropies[slot] = -entropies[slot]

            return result, entropies

        # Failed to retrieve anything
        print('Warning! Database call retrieved zero results.')
        return ['empty'], {}

        Perform an SQL database query

        :return: a dictionary containing the results of the query
        
plato/utilities/parser/parse_dstc2.py