def presign(self, token: str, filename: str) -> PresignedUrl:
        """
        Call HF API to get a presigned url to upload `filename` to S3.
        """
        path = "{}/api/presign".format(self.endpoint)
        r = requests.post(path, headers={"authorization": "Bearer {}".format(token)}, json={"filename": filename})
        r.raise_for_status()
        d = r.json()
        return PresignedUrl(**d)

        Call HF API to get a presigned url to upload `filename` to S3.
        
xtune/src/transformers/hf_api.py