def METHOD_NAME(data, fileNameOrObj, fileFormat):
    """Save a RGB image to a file.
    :param data: A 3D array (h, w, 3) storing an RGB image.
    :type data: numpy.ndarray with of unsigned bytes.
    :param fileNameOrObj: Filename or object to use to write the image.
    :type fileNameOrObj: A str or a 'file-like' object with a 'write' method.
    :param str fileFormat: The type of the file in: 'png', 'ppm', 'svg', 'tiff'.
    """
    assert len(data.shape) == 3
    assert data.shape[2] == 3
    assert fileFormat in ('png', 'ppm', 'svg', 'tif', 'tiff')
    if not hasattr(fileNameOrObj, 'write'):
        if fileFormat in ('png', 'ppm', 'tiff'):
            # Open in binary mode
            fileObj = open(fileNameOrObj, 'wb')
        else:
            fileObj = open(fileNameOrObj, 'w', newline='')
    else:  # Use as a file-like object
        fileObj = fileNameOrObj
    if fileFormat == 'svg':
        height, width = data.shape[:2]
        base64Data = base64.b64encode(convertRGBDataToPNG(data))
        fileObj.write(
            '<?xml version="1.0" encoding="UTF-8" standalone="no"?>\n')
        fileObj.write('<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"\n')
        fileObj.write(
            '  "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n')
        fileObj.write('<svg xmlns:xlink="http://www.w3.org/1999/xlink"\n')
        fileObj.write('     xmlns="http://www.w3.org/2000/svg"\n')
        fileObj.write('     version="1.1"\n')
        fileObj.write('     width="%d"\n' % width)
        fileObj.write('     height="%d">\n' % height)
        fileObj.write('    <image xlink:href="data:image/png;base64,')
        fileObj.write(base64Data.decode('ascii'))
        fileObj.write('"\n')
        fileObj.write('           x="0"\n')
        fileObj.write('           y="0"\n')
        fileObj.write('           width="%d"\n' % width)
        fileObj.write('           height="%d"\n' % height)
        fileObj.write('           id="image" />\n')
        fileObj.write('</svg>')
    elif fileFormat == 'ppm':
        height, width = data.shape[:2]
        fileObj.write(b'P6\n')
        fileObj.write(b'%d %d\n' % (width, height))
        fileObj.write(b'255\n')
        fileObj.write(data.tobytes())
    elif fileFormat == 'png':
        fileObj.write(convertRGBDataToPNG(data))
    elif fileFormat in ('tif', 'tiff'):
        if fileObj == fileNameOrObj:
            raise NotImplementedError(
                'Save TIFF to a file-like object not implemented')
        tif = TiffIO(fileNameOrObj, mode='wb+')
        tif.writeImage(data, info={'Title': 'OpenGL Plot Snapshot'})
    if fileObj != fileNameOrObj:
        fileObj.close()