def METHOD_NAME(fn, vertices, faces, colors=None, file_format='binary'):
    """
    Save list of triangles to PLY file.
    Parameters
    ----------
    fn : string
        File name to write
    vertices : np.array or list
        An n_vertices x 3 array or list of floats.
    faces : np.array or list
        An n_faces x m (usually m=3) array of indexes to vertices. Faces can
        describe any polygon with 3 or more sides.
    colors : np.array
        A n_vertices x 3 array of RGB colors.
    file_format : str
        Write PLY as ascii or binary
    Returns
    -------
    None
    """
    file_formats = ['ascii', 'binary']
    if file_format not in file_formats:
        print('Weird file format. Defaulting to ascii.')
        file_format = 'ascii'
    mode = 'w'
    if file_format == 'binary':
        mode = 'wb'
        import sys
        if sys.byteorder == 'little':
            file_format = 'binary_little_endian'
            order = '<'
        else:
            file_format = 'binary_big_endian'
            order = '>'
    with open(fn, mode) as f:
        h_str = ''
        h_str += 'ply\nformat {} 1.0\n'.format(file_format)
        h_str += 'element vertex {}\n'.format(len(vertices))
        h_str += 'property float x\nproperty float y\nproperty float z\n'
        if colors is not None:
            h_str += 'property uchar red\nproperty uchar green\nproperty uchar blue\n'
        h_str += 'element face {}\n'.format(len(faces))
        h_str += 'property list uchar int vertex_index\n'
        h_str += 'end_header\n'
        if file_format == 'ascii':
            f.write(h_str)
            if colors is not None:
                for _iv in np.arange(len(vertices)):
                    f.write('{} {} {} {} {} {}\n'.format(vertices[_iv,0], 
                                                        vertices[_iv,1], 
                                                        vertices[_iv,2], 
                                                        colors[_iv, 0], 
                                                        colors[_iv, 1], 
                                                        colors[_iv, 2]))
            else:
                for _iv in np.arange(len(vertices)):
                    f.write('{} {} {}\n'.format(vertices[_iv,0],
                                                vertices[_iv,1], 
                                                vertices[_iv,2]))
            for _if in np.arange(len(faces)):
                curr_faces = faces[_if]
                f.write(str(curr_faces.size) + ' ' + ' '.join(str(x) for x in curr_faces) + '\n')
        else:
            f.write(h_str.encode('ascii'))
            if colors is not None:
                for _iv in np.arange(len(vertices)):
                    f.write(vertices[_iv].astype(order + 'f4'))
                    f.write(colors[_iv].astype(order + 'u1'))
            else:
                for _iv in np.arange(len(vertices)):
                    f.write(vertices[_iv].astype(order + 'f4'))
            for _if in np.arange(len(faces)):
                curr_faces = faces[_if]
                f.write(np.ubyte(curr_faces.size))
                f.write(curr_faces.astype(order + 'i4'))