<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def license_cleanup(text):
 """Tidy up a license string e.g. "::OSI:: mit software license" -> "MIT" """

    if not text:
        return None
    text = text.rsplit(':', 1)[-1]
    replacements = [
        'licenses',
        'license',
        'licences',
        'licence',
        'software',
        ',',
    ]
    for replacement in replacements:
        text = text.replace(replacement, '')
    text = text.strip().upper()
    text = text.replace(' ', '_')
    text = text.replace('-', '_')
    if any(trigger.upper() in text for trigger in BAD_LICENSES):
        return None
    return text