def redact_secrets(line):
    """
    Returns a sanitized string for any ``line`` that looks like it contains a
    secret (i.e. matches SECRET_PATTERN).
    """
    def redact(match):
        if match.group(2) in SECRET_WHITELIST:
            return match.group(0)
        return match.group(1) + 'TOO_TOO_SEXY'
    return SECRET_PATTERN.sub(redact, line)
def redact_secrets ( line ) : def redact ( match ) : if match . group ( 2 ) in SECRET_WHITELIST : return match . group ( 0 ) return match . group ( 1 ) + 'TOO_TOO_SEXY' return SECRET_PATTERN . sub ( redact , line )
Returns a sanitized string for any ``line`` that looks like it contains a
    secret (i.e. matches SECRET_PATTERN).