def METHOD_NAME(user: types.User) -> str:
    """
    Check whether the user is embargoed based on the country code in the user's profile.
    Args:
        user (User): The user attempting to access courseware.
    Returns:
        user country from profile.
    """
    cache_key = f'user.{user.id}.profile.country'
    profile_country = cache.get(cache_key)
    if profile_country is None:
        profile = getattr(user, 'profile', None)
        if profile is not None and profile.country.code is not None:
            profile_country = profile.country.code.upper()
        else:
            profile_country = ""
        cache.set(cache_key, profile_country)
    return profile_country