Given a blob of ciphertext as a bytestring, try to decrypt
    the cipher and return the decrypted string. If the cipher cannot be
    decrypted, log the error, and return the ciphertext back out.

def _decrypt_ciphertext(cipher, translate_newlines=False):
    '''
    Given a blob of ciphertext as a bytestring, try to decrypt
    the cipher and return the decrypted string. If the cipher cannot be
    decrypted, log the error, and return the ciphertext back out.
    '''
    if translate_newlines:
        cipher = cipher.replace(r'\n', '\n')
    if hasattr(cipher, 'encode'):
        cipher = cipher.encode(__salt_system_encoding__)

    # Decryption
    data_key = _base64_plaintext_data_key()
    plain_text = fernet.Fernet(data_key).decrypt(cipher)
    if hasattr(plain_text, 'decode'):
        plain_text = plain_text.decode(__salt_system_encoding__)
    return six.text_type(plain_text)