def path_element_to_string(path_element):
    """Convert a single path element to its escaped string representation."""
    res = ""
    for char in path_element:
        if char == '\\':
            res += "\\\\"
        elif char == '/':
            res += "\\/"
        else:
            res += char
    return res