How to open and process .rtf files in Flask

Solution
file = request.files['file']
as_string = file.read().decode('utf-8')
text = rtf_to_text(as_string)