def replace(self, photo, photo_file, **kwds):
        """
        Endpoint: /photo/<id>/replace.json

        Uploads the specified photo file to replace an existing photo.
        """
        with open(photo_file, 'rb') as in_file:
            result = self._client.post("/photo/%s/replace.json" %
                                       self._extract_id(photo),
                                       files={'photo': in_file},
                                       **kwds)["result"]
        return Photo(self._client, result)