def generate_annotation(x, y, text, color='black', fsize=12, textangle=0, xref='paper',
                       yref='paper', align='left'):
    """
    Generates a plotly annotation in the form of dictionary.
    It can be directly be appended to the layout.annotations.
    :param x: x coordinate in plot
    :param y: y coordinate in plot
    :param text: text content
    :param color: color of text
    :param fsize: font size
    :param textangle: angle of text
    :param xref: reference to 'paper'/canvas or 'plot'/axis coordinates, more details in `plotly` documentation
    :param yref: reference to 'paper'/canvas or 'plot'/axis coordinate,  more details in `plotly` documentation
    :return: The annotation object to append in the `layout` of the figure.
    """
    res = dict(
        y=y,
        x=x,
        showarrow=False,
        textangle=textangle,
        text=text,
        font=dict(
            color=color,
            size=fsize
        ),
        align = align,
        xref=xref,
        yref=yref
    )
    return res