def METHOD_NAME(var_type, value, causality, initial, variability):
    var_obj = var_type("var", causality=causality, description="a variable", initial=initial, variability=variability)
    class PySlave(Fmi2Slave):
        def __init__(self, **kwargs):
            super().__init__(**kwargs)
            setattr(self, "var", value)
            self.register_variable(var_obj)
        def do_step(self, current_time: float, step_size: float):
            return True
    slave = PySlave(instance_name="testInstance")
    xml = slave.to_xml()
    var_node = xml.find(".//ScalarVariable[@name='var']")
    assert var_node is not None
    if ScalarVariable.requires_start(var_obj):
        assert var_obj.start == value
    else:
        assert var_obj.start is None