'Converts a dict of RDF values into a SQL-ready form.'

def _ConvertToCanonicalSqlDict(self, schema, raw_dict, prefix=''):

    flattened_dict = {}
    for (k, v) in raw_dict.items():
        if isinstance(v, dict):
            flattened_dict.update(self._ConvertToCanonicalSqlDict(schema, v, prefix=('%s%s.' % (prefix, k))))
        else:
            field_name = (prefix + k)
            flattened_dict[field_name] = schema[field_name].convert_fn(v)
    return flattened_dict
