human
Complete this python program:
def create_many_related_manager(superclass, rel=False):
assistant
#Here is the Python program you requested.

    """Creates a manager that subclasses \superclass\ (which is a Manager)
    and adds behavior for many-to-many related objects.
    """
    through = rel.through
    class ManyRelatedManager(superclass, ):
        def __init__(self, model=None, core_filters=None, instance=None, symmetrical=None, join_table=None, source_field_name=None, target_field_name=None, reverse=False):
            super(ManyRelatedManager, self).__init__()
            self.core_filters = core_filters
            self.model = model
            self.symmetrical = symmetrical
            self.instance = instance
            self.source_field_name = source_field_name
            self.target_field_name = target_field_name
            self.through = through
            self._pk_val = self.instance.pk
            self.reverse = reverse
            if (self._pk_val is None):
                raise ValueError(('%r    instance    needs    to    have    a    primary    key    value    before    a    many-to-many    relationship    can    be    used.' % instance.__class__.__name__))
        def get_query_set(self):
            db = (self._db or router.db_for_read(self.instance.__class__, instance=self.instance))
            return superclass.get_query_set(self).using(db)._next_is_sticky().filter(**self.core_filters)
        if rel.through._meta.auto_created:
            def add(self, *objs):
                self._add_items(self.source_field_name, self.target_field_name, *objs)
                if self.symmetrical:
                    self._add_items(self.target_field_name, self.source_field_name, *objs)
            add.alters_data = True
            def remove(self, *objs):
                self._remove_items(self.source_field_name, self.target_field_name, *objs)
                if self.symmetrical:
                    self._remove_items(self.target_field_name, self.source_field_name, *objs)
            remove.alters_data = True
        def clear(self):
            self._clear_items(self.source_field_name)
            if self.symmetrical:
                self._clear_items(self.target_field_name)
        clear.alters_data = True
        def create(self, **kwargs):
            if (not...