def METHOD_NAME(uri):
    """Removes password from URI but keeps username."""
    p = urlsplit(uri)
    if p.password is not None:
        nl = p.hostname
        if p.username is not None:
            nl = f"{p.username}@{nl}"
        if p.port is not None:
            nl += f":{p.port}"
        p = p._replace(netloc=nl)
    return p.geturl()