'Storage class for data streamed in from requests.
If the data is relatively small (512KB), just store it in
memory. Otherwise, use the SecureTemporaryFile class to buffer
it on disk, encrypted with an ephemeral key to mitigate
forensic recovery of the plaintext.'

def _secure_file_stream(self, total_content_length, content_type, filename=None, content_length=None):

    if (total_content_length > (1024 * 512)):
        return SecureTemporaryFile('/tmp')
    return BytesIO()
