def create_pvsm_file(vtk_files, pvsm_filename, relative_paths=True):
    """
    Create paraview status file (.pvsm) based on input vtk files.
    :param vtk_files:
    :param pvsm_filename:
    :param relative_paths:
    :return:
    """
    from xml.etree.ElementTree import Element, SubElement, Comment
    import os.path as op

    top = Element('ParaView')

    comment = Comment('Generated for PyMOTW')
    top.append(comment)

    numberi = 4923
    # vtk_file = "C:\Users\miros\lisa_data\83779720_2_liver.vtk"

    sms = SubElement(top, "ServerManagerState", version="5.4.1")
    file_list = SubElement(sms, "ProxyCollection", name="sources")
    for vtk_file_orig in vtk_files:
        numberi +=1
        dir, vtk_file_head = op.split(vtk_file_orig)
        if relative_paths:
            vtk_file = vtk_file_head
        else:
            vtk_file = vtk_file_orig
        number = str(numberi)
        proxy1 = SubElement(sms, "Proxy", group="sources", type="LegacyVTKFileReader", id=number, servers="1")
        property = SubElement(proxy1, "Property", name="FileNameInfo", id=number + ".FileNameInfo", number_of_elements="1")
        element = SubElement(property, "Element", index="0", value=vtk_file)
        property2 = SubElement(proxy1, "Property", name="FileNames", id=number + ".FileNames", number_of_elements="1")
        pr2s1 = SubElement(property2, "Element", index="0", value=vtk_file)
        pr2s2 = SubElement(property2, "Domain", name="files", id=number + ".FileNames.files")

    #     < Property
    #     name = "Opacity"
    #     id = "8109.Opacity"
    #     number_of_elements = "1" >
    #     < Element
    #     index = "0"
    #     value = "0.28" / >
    #     < Domain
    #     name = "range"
    #     id = "8109.Opacity.range" / >
    # < / Property >

        fn1 = SubElement(file_list, "Item", id=number, name=vtk_file_head)

    xml_str = prettify(top)
    # logger.debug(xml_str)
    with open(op.expanduser(pvsm_filename), "w") as file:
        file.write(xml_str)