def METHOD_NAME(self, trakt_pin=None, refresh=False, count=0):
    if count > 3:
        settings.TRAKT_ACCESS_TOKEN = ""
        return False
    elif count > 0:
        time.sleep(2)
    data = {"client_id": settings.TRAKT_API_KEY, "client_secret": settings.TRAKT_API_SECRET, "redirect_uri": "urn:ietf:wg:oauth:2.0:oob"}
    if refresh:
        data["grant_type"] = "refresh_token"
        data["refresh_token"] = settings.TRAKT_REFRESH_TOKEN
    else:
        data["grant_type"] = "authorization_code"
        if trakt_pin:
            data["code"] = trakt_pin
    headers = CaseInsensitiveDict({"Content-Type": "application/json"})
    resp = self.traktRequest("oauth/token", data=data, headers=headers, url=self.auth_url, method="POST", count=count)
    if "access_token" in resp:
        settings.TRAKT_ACCESS_TOKEN = resp["access_token"]
        if "refresh_token" in resp:
            settings.TRAKT_REFRESH_TOKEN = resp["refresh_token"]
        return True
    return False