def create_legend(axis, text, fontsize='small', legframeon=False,
                  location='upper right', legncol=1, legshadow=True,
                  legtitle="", lwd=0.5):
    """
    Function to create legends on matplotlib plots.

    :param matplotlib.Axis axis: the axis object to associate the legend with.
    :param tuple text: the text to display in the legend.
    :keyword str fontsize: the size of the font to use for the legend.  Options
                           are:
                           - xx-small
                           - x-small
                           - small (default)
                           - medium
                           - large
                           - x-large
                           - xx-large
    :keyword boolean legframeon: whether or not there is a frame around the
                                 legend.
    :keyword str location: the location of the legend on the plot.  Options
                           are:
                           - best
                           - upper right (default)
                           - upper left
                           - lower left
                           - lower right
                           - right
                           - center left
                           - center right
                           - lower center
                           - upper center
                           - center
    :keyword int legncol: the number columns in the legend.  Default is 1.
    :keyword boolean legshadow: whether or not to display a shadow behind the
                                legend block.  Default is True.
    :keyword str legtitle: the title of the legend.  Default is an emptry
                           string.
    :keyword float lwd: the linewidth of the box around the legend.
    :return: False if successful or True if an error is encountered.
    :rtype: bool
    """

    _legend = axis.legend(text, frameon=legframeon, loc=location, ncol=legncol,
                          shadow=legshadow, title=legtitle)

    for _text in _legend.get_texts():
        _text.set_fontsize(fontsize)
    for _line in _legend.get_lines():
        _line.set_linewidth(lwd)

    return False