def _make_file_dict(self, f):
if isinstance(f, dict):<EOL><INDENT>file_obj = f['<STR_LIT:file>']<EOL>if '<STR_LIT:filename>' in f:<EOL><INDENT>file_name = f['<STR_LIT:filename>']<EOL><DEDENT>else:<EOL><INDENT>file_name = file_obj.name<EOL><DEDENT><DEDENT>else:<EOL><INDENT>file_obj = f<EOL>file_name = f.name<EOL><DEDENT>b64_data = base64.b64encode(file_obj.read())<EOL>return {<EOL>'<STR_LIT:id>': file_name,<EOL>'<STR_LIT:data>': b64_data.decode() if six.PY3 else b64_data,<EOL>}<EOL>
Make a dictionary with filename and base64 file data