def METHOD_NAME(code=None, obj=object, strFields=None, trace=None):
    """The alert function is used for writing alerts to the standard error stream.
    Only the ErrorHandler class can receive alerts via the "receiveAlert" method.
    Parameters
    ----------
    code: int
        The 4 digit code for retrieving alert from AlertCatalogue
    obj: object
        The object related to the alert e.g., TextComponent object
    strFields: dict
        Dict containing relevant values for formatting messages
    trace: sys.exec_info() traceback object
            The traceback
    """
    msg = AlertEntry(code, obj, strFields, trace)
    # format the warning into a string for console and logging targets
    msgAsStr = ("Alert {code}: {msg}\n"
                "For more info see https://docs.psychopy.org/alerts/{code}.html"
                .format(type=msg.type,
                        name=msg.name,
                        code=msg.code,
                        cat=msg.cat,
                        msg=msg.msg,
                        trace=msg.trace))
    # msgAsStr = ("Component Type: {type} | "
    #             "Component Name: {name} | "
    #             "Code: {code} | "
    #             "Category: {cat} | "
    #             "Message: {msg} | "
    #             "Traceback: {trace}".format(type=msg.type,
    #                                         name=msg.name,
    #                                         code=msg.code,
    #                                         cat=msg.cat,
    #                                         msg=msg.msg,
    #                                         trace=msg.trace))
    # if a psychopy warning instead of a file-like stderr then pass a raw str
    if hasattr(sys.stderr, 'receiveAlert'):
        sys.stderr.receiveAlert(msg)
    else:
        # For tests detecting output - change when error handler set up
        sys.stderr.write(msgAsStr)
        for handler in _activeAlertHandlers:
            handler.receiveAlert(msg)