def refresh(self):
        """
        Refresh session on 401. This is called automatically if your existing
        session times out and resends the operation/s which returned the
        error.

        :raises SMCConnectionError: Problem re-authenticating using existing
            api credentials
        """
        if self.session and self.session_id: # Did session timeout?
            logger.info('Session timed out, will try obtaining a new session using '
                'previously saved credential information.')
            self.logout() # Force log out session just in case
            return self.login(**self.copy())
        raise SMCConnectionError('Session expired and attempted refresh failed.')