def preprocess_incoming_content(content, encrypt_func, max_size_bytes):
encrypted = encrypt_func(content)<EOL>if max_size_bytes != UNLIMITED and len(encrypted) > max_size_bytes:<EOL><INDENT>raise FileTooLarge()<EOL><DEDENT>return encrypted<EOL>
Apply preprocessing steps to file/notebook content that we're going to
write to the database.

Applies ``encrypt_func`` to ``content`` and checks that the result is
smaller than ``max_size_bytes``.