def sanitize_log_data(secret, data=None, leave_characters=LEAVE_CHARS):
 replace_secret = (secret[:leave_characters] + ((len(secret) - leave_characters) * '*'))
 if data:
  return data.replace(secret, replace_secret)
 return replace_secret

def sanitize_log_data ( secret , data = None , leave_characters = LEAVE_CHARS ) : replace_secret = ( secret [ : leave_characters ] + ( ( len ( secret ) - leave_characters ) * '*' ) ) if data : return data . replace ( secret , replace_secret ) return replace_secret
clean private/secret data from log statements and other data .