'Return a static image of the plot described by `figure_or_data`.
positional arguments:
- figure_or_data: The figure dict-like or data list-like object that
describes a plotly figure.
Same argument used in `py.plot`, `py.iplot`,
see https://plot.ly/python for examples
- format: \'png\', \'svg\', \'jpeg\', \'pdf\'
- width: output width
- height: output height
- scale: Increase the resolution of the image by `scale`
amount (e.g. `3`)
Only valid for PNG and JPEG images.
example:
import plotly.plotly as py
fig = {\'data\': [{\'x\': [1, 2, 3], \'y\': [3, 1, 5], \'type\': \'bar\'}]}
py.image.get(fig, \'png\', scale=3)'

@staticmethod
def get(figure_or_data, format='png', width=None, height=None, scale=None):

    if isinstance(figure_or_data, dict):
        figure = figure_or_data
    elif isinstance(figure_or_data, list):
        figure = {'data': figure_or_data}
    else:
        raise exceptions.PlotlyEmptyDataError('`figure_or_data`    must    be    a    dict    or    a    list.')
    if (format not in ['png', 'svg', 'jpeg', 'pdf']):
        raise exceptions.PlotlyError('Invalid    format.    This    version    of    your    Plotly-Python    package    currently    only    supports    png,    svg,    jpeg,    and    pdf.    Learn    more    about    image    exporting,    and    the    currently    supported    file    types    here:    https://plot.ly/python/static-image-export/')
    if (scale is not None):
        try:
            scale = float(scale)
        except:
            raise exceptions.PlotlyError('Invalid    scale    parameter.    Scale    must    be    a    number.')
    payload = {'figure': figure, 'format': format}
    if (width is not None):
        payload['width'] = width
    if (height is not None):
        payload['height'] = height
    if (scale is not None):
        payload['scale'] = scale
    response = v2.images.create(payload)
    headers = response.headers
    if (('content-type' in headers) and (headers['content-type'] in ['image/png', 'image/jpeg', 'application/pdf', 'image/svg+xml'])):
        return response.content
    elif (('content-type' in headers) and ('json' in headers['content-type'])):
        return response.json()['image']
