code: def disconnect(self):
          
  
          # when __del__() is invoked in response to a module being deleted,
          # e.g., when execution of the program is done, other globals referenced
          # by the __del__() method may already have been deleted.
          # this causes CardConnection.disconnect to except with a TypeError
          try:
              CardConnection.disconnect(self)
          except TypeError:
              pass
          if None != self.hcard:
              hresult = SCardDisconnect(self.hcard, self.disposition)
              if hresult != 0:
                  raise CardConnectionException(
                      'Failed to disconnect: ' + \
                      SCardGetErrorMessage(hresult))
              self.hcard = None
docs: Disconnect from the card.