def twostep(script, iterations=3, angle_threshold=60, normal_steps=20, fit_steps=20,
            selected=False):
    """ Two Step Smoothing, a feature preserving/enhancing fairing filter.

    It is based on a Normal Smoothing step where similar normals are averaged
    together and a step where the vertexes are fitted on the new normals.

    Based on:
    A. Belyaev and Y. Ohtake,
    "A Comparison of Mesh Smoothing Methods"
    Proc. Israel-Korea Bi-National Conf. Geometric Modeling and Computer
    Graphics, pp. 83-87, 2003.

    Args:
        script: the FilterScript object or script filename to write
            the filter to.
        iterations (int): The number of times that the whole algorithm (normal
            smoothing + vertex fitting) is iterated.
        angle_threshold (float): Specify a threshold angle (0..90) for features
            that you want to be preserved.  Features forming angles LARGER than
            the specified threshold will be preserved.
            0 -> no smoothing
            90 -> all faces will be smoothed
        normal_steps (int): Number of iterations of normal smoothing step. The
            larger the better and (the slower)
        fit_steps (int): Number of iterations of the vertex fitting procedure
        selected (bool): If selected the filter is performed only on the
            selected faces

    Layer stack:
        No impacts

    MeshLab versions:
        2016.12
        1.3.4BETA
    """
    filter_xml = ''.join([
        '  <filter name="TwoStep Smooth">\n',
        '    <Param name="stepSmoothNum" ',
        'value="{:d}" '.format(iterations),
        'description="Smoothing steps" ',
        'type="RichInt" ',
        '/>\n',
        '    <Param name="normalThr" ',
        'value="{}" '.format(angle_threshold),
        'description="Feature Angle Threshold (deg)" ',
        'type="RichFloat" ',
        '/>\n',
        '    <Param name="stepNormalNum" ',
        'value="{:d}" '.format(normal_steps),
        'description="Normal Smoothing steps" ',
        'type="RichInt" ',
        '/>\n',
        '    <Param name="stepFitNum" ',
        'value="{:d}" '.format(fit_steps),
        'description="Vertex Fitting steps" ',
        'type="RichInt" ',
        '/>\n',
        '    <Param name="Selected" ',
        'value="{}" '.format(str(selected).lower()),
        'description="Affect only selected faces" ',
        'type="RichBool" ',
        '/>\n',
        '  </filter>\n'])
    util.write_filter(script, filter_xml)
    return None
Two Step Smoothing, a feature preserving/enhancing fairing filter.

    It is based on a Normal Smoothing step where similar normals are averaged
    together and a step where the vertexes are fitted on the new normals.

    Based on:
    A. Belyaev and Y. Ohtake,
    "A Comparison of Mesh Smoothing Methods"
    Proc. Israel-Korea Bi-National Conf. Geometric Modeling and Computer
    Graphics, pp. 83-87, 2003.

    Args:
        script: the FilterScript object or script filename to write
            the filter to.
        iterations (int): The number of times that the whole algorithm (normal
            smoothing + vertex fitting) is iterated.
        angle_threshold (float): Specify a threshold angle (0..90) for features
            that you want to be preserved.  Features forming angles LARGER than
            the specified threshold will be preserved.
            0 -> no smoothing
            90 -> all faces will be smoothed
        normal_steps (int): Number of iterations of normal smoothing step. The
            larger the better and (the slower)
        fit_steps (int): Number of iterations of the vertex fitting procedure
        selected (bool): If selected the filter is performed only on the
            selected faces

    Layer stack:
        No impacts

    MeshLab versions:
        2016.12
        1.3.4BETA