def METHOD_NAME(cluster, demand, level):
    # Initialize
    size = 0
    out = open("input.xml", "wt")
    print('<plan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">', file=out)
    # Items
    print("<items>", file=out)
    for i in range(cluster):
        ++size
        print('<item name="Item C%d"/>' % i, file=out)
    print("</items>", file=out)
    # Demands
    print("<demands>", file=out)
    for i in range(cluster):
        for j in range(demand):
            size += 2  # since a demand will result in multiple operationplans
            print(
                (
                    '<demand name="Demand C%dD%d" '
                    + 'quantity="1" due="%s">'
                    + '<location name="factory"/>'
                    + '<operation name="factory"/>'
                    + '<item name="Item C%d"/></demand>'
                )
                % (i, j, getDate(), i),
                file=out,
            )
    print("</demands>", file=out)
    # Operations
    print("<operations>", file=out)
    for i in range(cluster):
        print(
            (
                '<operation name="Del C%d"> <flows>'
                + '<flow xsi:type="flow_start" quantity="-1">'
                + '<buffer name="Buffer C%dL1"/></flow>'
                + "</flows></operation>"
            )
            % (i, i),
            file=out,
        )
        for j in range(level):
            size += 2
            print(
                (
                    '<operation name="Oper C%dO%d" '
                    + 'xsi:type="operation_fixed_time" '
                    + 'duration="PT%dH"> <flows>'
                    + '<flow xsi:type="flow_end" quantity="1">'
                    + '<buffer name="Buffer C%dL%d">'
                    + '<producing name="Oper C%dO%d"/></buffer></flow>'
                    + '<flow xsi:type="flow_start" quantity="-1">'
                    + '<buffer name="Buffer C%dL%d"/></flow>'
                    + '</flows><location name="factory"/></operation>'
                )
                % (i, j, 24 * int(random.uniform(0, 10) + 1), i, j, i, j, i, j + 1),
                file=out,
            )
    # Create material supply
    for i in range(cluster):
        print(
            (
                '<operation name="Supply C%d"> '
                + '<location name="factory"/>'
                + '<flows><flow xsi:type="flow_end" quantity="1">'
                + '<buffer name="Buffer C%dL%d"/>'
                + "</flow></flows></operation>"
            )
            % (i, i, level + 1),
            file=out,
        )
    print("</operations>\n<operationplans>", file=out)
    for i in range(cluster):
        print(
            (
                '<operationplan id="%d" '
                + 'start="2007-05-01T00:00:00" quantity="%d" '
                + 'status="confirmed"><operation name="Supply C%d"/></operationplan>'
            )
            % (i + 2, demand, i),
            file=out,
        )
    print("</operationplans>", file=out)
    # Tail of the output file
    print("</plan>", file=out)
    out.close()
    # Return size indication
    return size