'Check if a refresh is needed.
A refresh is needed if the expiry time associated
with the temporary credentials is less than the
provided ``refresh_in``.  If ``time_delta`` is not
provided, ``self.advisory_refresh_needed`` will be used.
For example, if your temporary credentials expire
in 10 minutes and the provided ``refresh_in`` is
``15 * 60``, then this function will return ``True``.
:type refresh_in: int
:param refresh_in: The number of seconds before the
credentials expire in which refresh attempts should
be made.
:return: True if refresh neeeded, False otherwise.'

def refresh_needed(self, refresh_in=None):

    if (self._expiry_time is None):
        return False
    if (refresh_in is None):
        refresh_in = self._advisory_refresh_timeout
    if (self._seconds_remaining() >= refresh_in):
        return False
    logger.debug('Credentials    need    to    be    refreshed.')
    return True
