def dot_escape(label_content):
    """
    Escape the given string so it is safe inside a GraphViz record label. Only
    actually handles the caharcters found in Avro type definitions, so not
    general purpose.

    """

    return (label_content.replace("&", "&amp;").replace("<", "&lt;")
        .replace(">", "&gt;").replace("\"", "&quot;"))