def _ply_header(num_vertices, num_faces, use_vertex_colors=False):
    """
    Return a string representing the PLY format header for the given data properties.
    """
    hdr_top = 'ply\nformat ascii 1.0\ncomment Generated by Brainload\n'
    hdr_verts = (
        'element vertex %d\nproperty float x\nproperty float y\nproperty float z\n'
         % num_vertices)
    hdr_vertex_colors = """property uchar red
property uchar green
property uchar blue
property uchar alpha
"""
    hdr_face = ('element face %d\nproperty list uchar int vertex_indices\n' %
        num_faces)
    hdr_end = 'end_header\n'
    if use_vertex_colors:
        hdr_elements = [hdr_top, hdr_verts, hdr_vertex_colors, hdr_face,
            hdr_end]
    else:
        hdr_elements = [hdr_top, hdr_verts, hdr_face, hdr_end]
    return ''.join(hdr_elements)
