<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def showRejectionMessage(worksheet):
 """ Adds a portalMessage if a) the worksheet has been rejected and replaced by another or b) if the worksheet is the replacement of a rejected worksheet. Otherwise, does nothing. """

    if hasattr(worksheet, 'replaced_by'):
        uc = getToolByName(worksheet, 'uid_catalog')
        uid = getattr(worksheet, 'replaced_by')
        _ws = uc(UID=uid)[0].getObject()
        msg = _("This worksheet has been rejected.  The replacement worksheet is ${ws_id}",
                mapping={'ws_id':_ws.getId()})
        worksheet.plone_utils.addPortalMessage(msg)
    if hasattr(worksheet, 'replaces_rejected_worksheet'):
        uc = getToolByName(worksheet, 'uid_catalog')
        uid = getattr(worksheet, 'replaces_rejected_worksheet')
        _ws = uc(UID=uid)[0].getObject()
        msg = _("This worksheet has been created to replace the rejected "
                "worksheet at ${ws_id}",
                mapping={'ws_id':_ws.getId()})
        worksheet.plone_utils.addPortalMessage(msg)