def METHOD_NAME(self, pyfile):
    file_id = self.info["pattern"]["ID"]
    if self.info["access"] == "premium":
        self.fail(self._("File can be downloaded by premium users only"))
    elif self.info["access"] == "private":
        self.fail(self._("This is a private file"))
    try:
        api_data = self.api_request(
            "GetUrl",
            file_id=file_id,
            free_download_key=None,
            captcha_challenge=None,
            captcha_response=None,
        )
    except BadHeader as exc:
        if exc.code == 406:
            for i in range(10):
                api_data = self.api_request("RequestCaptcha")
                if api_data["code"] != 200:
                    self.fail(self._("Request captcha API failed"))
                captcha_response = self.captcha.decrypt(api_data["captcha_url"])
                try:
                    api_data = self.api_request(
                        "GetUrl",
                        file_id=file_id,
                        free_download_key=None,
                        captcha_challenge=api_data["challenge"],
                        captcha_response=captcha_response,
                    )
                except BadHeader as exc:
                    if exc.code == 406:
                        api_data = json.loads(exc.content)
                        if api_data["errorCode"] == 31:  #: ERROR_CAPTCHA_INVALID
                            self.captcha.invalid()
                            continue
                        elif (
                            api_data["errorCode"] == 42
                        ):  #: ERROR_DOWNLOAD_NOT_AVAILABLE
                            self.captcha.correct()
                            self.retry(wait=api_data["errors"][0]["timeRemaining"])
                        else:
                            self.fail(api_data["message"])
                    else:
                        raise
                else:
                    self.captcha.correct()
                    free_download_key = api_data["free_download_key"]
                    break
            else:
                self.fail(self._("Max captcha retries reached"))
            self.wait(api_data["time_wait"])
            api_data = self.api_request(
                "GetUrl",
                file_id=file_id,
                free_download_key=free_download_key,
                captcha_challenge=None,
                captcha_response=None,
            )
            if api_data["code"] == 200:
                self.download(api_data["url"])
        else:
            raise
    else:
        self.download(api_data["url"])