'Check if token expires or not.'

def _token_is_expired(self, token):

    time_pos_begin = (token.find('ExpiresOn=') + len('ExpiresOn='))
    time_pos_end = token.find('&', time_pos_begin)
    token_expire_time = int(token[time_pos_begin:time_pos_end])
    time_now = time.mktime(time.localtime())
    return ((token_expire_time - time_now) < 30)
