@rbac(('owner', 'user'))
    def disconnect(self, varpath, varpath2=None):
        """If varpath2 is supplied, remove the connection between varpath and
        varpath2. Otherwise, if varpath is the name of a trait, remove all
        connections to/from varpath in the current scope. If varpath is the
        name of a Component, remove all connections from all of its inputs
        and outputs.
        """
        try:
            if varpath2 is None:
                to_remove = [(u,v) for u,v in self._connections
                               if u.refers_to(varpath) or v.refers_to(varpath)
                                  or u.text==varpath.strip()
                                  or v.text==varpath.strip()]
            else:
                to_remove = [(u,v) for u,v in self._connections
                               if u.text==varpath.strip()
                                  and v.text==varpath2.strip()]
            self._connections = [tup for tup in self._connections
                                    if tup not in to_remove]
        finally:
            self.config_changed(update_parent=False)
dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/openmdao.main/src/openmdao/main/assembly.py/Assembly.disconnect/original