code: def _remove_account(self, accounts):
          
          for account in to_list(accounts):
              if account not in self.accounts:
                  msg = 'attempt to remove unknown account %s' % account
                  raise Exception(msg)
              if account not in self.unlocked_accounts:
                  raise Exception('account %s should be unlocked' % account)
              account.acquired_event.disconnect(self._on_account_acquired)
              account.released_event.disconnect(self._on_account_released)
              self.accounts.remove(account)
              self.unlocked_accounts.remove(account)
docs: :type  accounts: Account|list[Account]
          :param accounts: The accounts to be removed.