<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def corner_text( text, distance=0.075, *, ax=None, corner="UL", factor=200, bbox=True, fontsize=18, background_alpha=1, edgecolor=None ):
 """Place some text in the corner of the figure. Parameters text : str The text to use. distance : number (optional) Distance from the corner. Default is 0.05. ax : axis (optional) The axis object to label. If None, uses current axis. Default is None. corner : {'UL', 'LL', 'UR', 'LR'} (optional) The corner to label. Upper left, Lower left etc. Default is UL. factor : number (optional) Scaling factor. Default is 200. bbox : boolean (optional) Toggle bounding box. Default is True. fontsize : number (optional) Text fontsize. If None, uses the matplotlib default. Default is 18. background_alpha : number (optional) Opacity of background bounding box. Default is 1. edgecolor : string (optional) Frame edgecolor. Default is None (inherits from legend.edgecolor rcparam). Returns ------- text The matplotlib text object. """

    # get axis
    if ax is None:
        ax = plt.gca()
    [h_scaled, v_scaled], [va, ha] = get_scaled_bounds(
        ax, corner, distance=distance, factor=factor
    )
    # get edgecolor
    if edgecolor is None:
        edgecolor = matplotlib.rcParams["legend.edgecolor"]
    # apply text
    props = dict(boxstyle="square", facecolor="white", alpha=background_alpha, edgecolor=edgecolor)
    args = [v_scaled, h_scaled, text]
    kwargs = {}
    kwargs["fontsize"] = fontsize
    kwargs["verticalalignment"] = va
    kwargs["horizontalalignment"] = ha
    if bbox:
        kwargs["bbox"] = props
    else:
        kwargs["path_effects"] = [PathEffects.withStroke(linewidth=3, foreground="w")]
    kwargs["transform"] = ax.transAxes
    if "zlabel" in ax.properties().keys():  # axis is 3D projection
        out = ax.text2D(*args, **kwargs)
    else:
        out = ax.text(*args, **kwargs)
    return out