def _stringify(tree, pretty):
    """
    Turn an ElementTree into a string, optionally with line breaks and indentation.
    """

    if pretty and feedformatterCanPrettyPrint:
        string = StringIO()
        doc = FromXml(ET.tostring(tree))
        PrettyPrint(doc, string, indent="    ")
        return string.getvalue()
    else:
        return ET.tostring(tree)
def _stringify(tree, pretty):
    """
    Turn an ElementTree into a string, optionally with line breaks and indentation.
    """

    if pretty and CAN_PRETTY_PRINT:
        string = StringIO()
        doc = FromXml(_element_to_string(tree))
        PrettyPrint(doc, string, indent="    ")

        return string.getvalue()
    else:
        return _element_to_string(tree)