def decrypt_file(file, key):
if not file.endswith('<STR_LIT>'):<EOL><INDENT>raise ValueError("<STR_LIT>" % file)<EOL><DEDENT>fer = Fernet(key)<EOL>with open(file, '<STR_LIT:rb>') as f:<EOL><INDENT>decrypted_file = fer.decrypt(f.read())<EOL><DEDENT>with open(file[:-<NUM_LIT:4>], '<STR_LIT:wb>') as f:<EOL><INDENT>f.write(decrypted_file)<EOL><DEDENT>os.chmod(file[:-<NUM_LIT:4>], <NUM_LIT>)<EOL>
Decrypts the file ``file``.

The encrypted file is assumed to end with the ``.enc`` extension. The
decrypted file is saved to the same location without the ``.enc``
extension.

The permissions on the decrypted file are automatically set to 0o600.

See also :func:`doctr.local.encrypt_file`.