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

    """Creates a manager that subclasses \superclass\ (which is a Manager)
    and adds behavior for many-to-many related objects.
    """
    class ManyRelatedManager(superclass, ):
        def __init__(self, model=None, core_filters=None, instance=None, symmetrical=None, join_table=None, source_col_name=None, target_col_name=None):
            super(ManyRelatedManager, self).__init__()
            self.core_filters = core_filters
            self.model = model
            self.symmetrical = symmetrical
            self.instance = instance
            self.join_table = join_table
            self.source_col_name = source_col_name
            self.target_col_name = target_col_name
            self._pk_val = self.instance._get_pk_val()
            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.' % model))
        def get_query_set(self):
            return superclass.get_query_set(self).filter(**self.core_filters)
        def add(self, *objs):
            self._add_items(self.source_col_name, self.target_col_name, *objs)
            if self.symmetrical:
                self._add_items(self.target_col_name, self.source_col_name, *objs)
        add.alters_data = True
        def remove(self, *objs):
            self._remove_items(self.source_col_name, self.target_col_name, *objs)
            if self.symmetrical:
                self._remove_items(self.target_col_name, self.source_col_name, *objs)
        remove.alters_data = True
        def clear(self):
            self._clear_items(self.source_col_name)
            if self.symmetrical:
                self._clear_items(self.target_col_name)
        clear.alters_data = True
        def create(self, **kwargs):
            new_obj = self.model(**kwargs)
            new_obj.save()
            self.add(new_obj)
            return new_obj
        create.alters_data = True
        def _add_items(self, source_col_name, target_col_name, *objs):
            from django.db import connection
            if objs:
                new_ids = set()
              ...