def project_usls_on_dictionary(usls, allowed_terms=None):
cells_to_usls = defaultdict(set)<EOL>tables = set()<EOL>for u in usls:<EOL><INDENT>for t in u.objects(Term):<EOL><INDENT>for c in t.singular_sequences:<EOL><INDENT>if not cells_to_usls[c]:<EOL><INDENT>tables.update(c.relations.contained)<EOL><DEDENT>cells_to_usls[c].add(u)<EOL><DEDENT><DEDENT><DEDENT>if allowed_terms:<EOL><INDENT>allowed_terms = set(allowed_terms)<EOL>tables = tables & allowed_terms<EOL>cells_to_usls = {c: l for c, l in cells_to_usls.items() if c in allowed_terms}<EOL><DEDENT>tables_to_usls = {<EOL>table: list(set(u for c in table.singular_sequences for u in cells_to_usls[c]))<EOL>for table in tables if not isinstance(table, TableSet)<EOL>}<EOL>return tables_to_usls<EOL>
`usls` is an iterable of usl.

    return a mapping term -> usl list