def _table_is_free(table_name, dependencies, sorted_tables):
    """Check if every child of this table is already sorted

    Look at the unit test test_table_is_free_simple to see some
    usage examples.
    """
    tables_this_table_depends_upon = dependencies.get(table_name, {})
    for dependency in tables_this_table_depends_upon.copy():
        if dependency.table_name_to in sorted_tables:
            tables_this_table_depends_upon.remove(dependency)
    return len(tables_this_table_depends_upon) == 0
