def _calculate_and_set_time_to_refresh(api_key):
    '\n    Calculates the time the access token needs to be refreshed and updates the relevant\n    api_key token data.\n    '
    if is_authenticated(api_key):
        token_expires = datetime.datetime.strptime(_get_token_info_by_api_key(api_key, EXPIRES), TOKEN_EXPIRED_DATE_FORMAT)
        API_KEYS_TO_TOKEN_DATA[api_key][TIME_TO_REFRESH] = (token_expires - REFRESH_TOKEN_SAFETY_MARGIN)
Calculates the time the access token needs to be refreshed and updates the relevant
api_key token data.
def _calculate_and_set_time_to_refresh(api_key):
    '\n    Calculates the time the access token needs to be refreshed and updates the relevant\n    api_key token data.\n    '
    if is_authenticated(api_key):
        token_expires = datetime.datetime.strptime(_get_token_info_by_api_key(api_key, EXPIRES), TOKEN_EXPIRED_DATE_FORMAT)
        API_KEYS_TO_TOKEN_DATA[api_key][TIME_TO_REFRESH] = (token_expires - REFRESH_TOKEN_SAFETY_MARGIN)