def METHOD_NAME(self, name, content):
    content = content.read()
    sha1 = hashlib.sha1()
    sha1.update(content.encode() if isinstance(content, str) else content)
    parts = name.split("/")
    if parts[1] in ("pub", "priv"):
        parts = parts[1:]
    elif parts[0] not in ("pub", "priv"):
        parts = ["priv"] + parts
    name = "/".join(parts)
    if "." in os.path.basename(name):
        bname, ext = os.path.basename(name).rsplit(".", 1)
        name = os.path.join(
            os.path.dirname(name), bname + "." + sha1.hexdigest()[:14] + "." + ext
        )
    else:
        name = os.path.join(
            os.path.dirname(name), os.path.basename(name) + "." + sha1[:14]
        )
    resp = requests.put(
        urllib.parse.urljoin(self.base_url, os.path.join("upload", name)),
        data=content,
        allow_redirects=False,
    )
    if resp.status_code != 409:
        resp.raise_for_status()
    loc = resp.headers["Location"]
    if loc.startswith("/"):
        loc = loc[1:]
    return loc