def uri_to_filename(uri: str) -> str:
    """
    Replace characters that are forbidden on filesystems with underscores.
    In URIs for singularity/docker images these are ':' and '/'.
    :param uri: the uri for which characters are replaced.
    :return: a valid filename.
    """
    return uri.replace("://", "_").replace("/", "_").replace(":", "_")