def close(self):
        """Close the transport after all oustanding data has been written."""
        if self._closing or self._handle.closed:
            return
        elif self._protocol is None:
            raise TransportError('transport not started')
        # If the write buffer is empty, close now. Otherwise defer to
        # _on_write_complete that will close when the buffer is empty.
        if self._write_buffer_size == 0:
            self._handle.close(self._on_close_complete)
            assert self._handle.closed
        else:
            self._closing = True
def close ( self ) : if self . _closing or self . _handle . closed : return elif self . _protocol is None : raise TransportError ( 'transport not started' ) if self . _write_buffer_size == 0 : self . _handle . close ( self . _on_close_complete ) assert self . _handle . closed else : self . _closing = True
Close the transport after all oustanding data has been written.