def rename(filepath: str, name: str, file_format: str, net: str) -> str:
    """
    :param filepath: path to file to create a new name for
    :param name: name of the object drawn
    :param file_format: type of content: video, picture of rosbag
    :param net: mainnet/testnet
    :return: new filename with a filepath
    """
    res = filepath[0: filepath.rfind("/") + 1] + filepath[filepath.rfind("."):]
    res = (
            res[0: res.rfind("/") + 1]
            + name
            + "_"
            + file_format
            + "_"
            + net
            + res[res.rfind("/") + 1:]
    )
    return res