'Apply various heuristics to return a colorized version the invoke
comman string. If these fail, simply return the string in plaintext.
Inspired by colorize_log_entry().'

def colorize_invoke_command(self, string):

    final_string = string
    try:
        try:
            for token in [u'START', u'END', u'REPORT', u'[DEBUG]']:
                if (token in final_string):
                    format_string = (u'{}' if (token == u'[DEBUG]') else u'[{}]')
                    final_string = final_string.replace(token, click.style(format_string.format(token), bold=True, fg=u'cyan'))
        except Exception:
            pass
        try:
            for token in [u'Zappa    Event:', u'RequestId:', u'Version:', u'Duration:', u'Billed', u'Memory    Size:', u'Max    Memory    Used:']:
                if (token in final_string):
                    final_string = final_string.replace(token, click.style(token, bold=True, fg=u'green'))
        except Exception:
            pass
        for token in final_string.replace(u' DCTB ', u'    ').split(u'    '):
            try:
                if ((token.count(u'-') is 4) and token.replace(u'-', u'').isalnum()):
                    final_string = final_string.replace(token, click.style(token, fg=u'magenta'))
            except Exception:
                pass
        return final_string
    except Exception:
        return string
