def report_error(title=None, data={}, caught=None, is_fatal=False):
<EOL>if os.environ.get('<STR_LIT>', None):<EOL><INDENT>pass<EOL><DEDENT>elif os.environ.get('<STR_LIT>', '<STR_LIT>') == '<STR_LIT:1>':<EOL><INDENT>log.info("<STR_LIT>")<EOL>return<EOL><DEDENT>elif '<STR_LIT>' in data:<EOL><INDENT>if not data['<STR_LIT>']:<EOL><INDENT>log.info("<STR_LIT>")<EOL>return<EOL><DEDENT><DEDENT>elif not is_ec2_instance():<EOL><INDENT>log.info("<STR_LIT>")<EOL>return<EOL><DEDENT>if '<STR_LIT:user>' not in data:<EOL><INDENT>populate_error_report(data)<EOL><DEDENT>data['<STR_LIT:title>'] = title<EOL>data['<STR_LIT>'] = is_fatal<EOL>if caught:<EOL><INDENT>data['<STR_LIT>'] = "<STR_LIT:%s>" % caught<EOL><DEDENT>data['<STR_LIT>'] = []<EOL>try:<EOL><INDENT>data['<STR_LIT>'] = [l for l in traceback.format_stack()]<EOL><DEDENT>except Exception:<EOL><INDENT>data['<STR_LIT>'] = '<STR_LIT>'<EOL><DEDENT>fname = '<STR_LIT>'<EOL>try:<EOL><INDENT>fname = inspect.stack()[<NUM_LIT:1>][<NUM_LIT:3>]<EOL><DEDENT>except Exception as e:<EOL><INDENT>fname = '<STR_LIT>'<EOL><DEDENT>status, code = '<STR_LIT>', '<STR_LIT>'<EOL>if '<STR_LIT>' in data:<EOL><INDENT>status = data['<STR_LIT>'].get('<STR_LIT:status>', status)<EOL>code = data['<STR_LIT>'].get('<STR_LIT>', code)<EOL>title_details = "<STR_LIT>" % (ApiPool().current_server_name, status, code)<EOL><DEDENT>else:<EOL><INDENT>title_details = "<STR_LIT>" % (ApiPool().current_server_name, fname)<EOL><DEDENT>if is_fatal:<EOL><INDENT>title_details = '<STR_LIT>' % title_details<EOL><DEDENT>else:<EOL><INDENT>title_details = '<STR_LIT>' % title_details<EOL><DEDENT>if title:<EOL><INDENT>title = "<STR_LIT>" % (title_details, title)<EOL><DEDENT>else:<EOL><INDENT>title = title_details<EOL><DEDENT>global error_reporter<EOL>log.info("<STR_LIT>")<EOL>try:<EOL><INDENT>error_reporter(title, json.dumps(data, sort_keys=True, indent=<NUM_LIT:4>))<EOL><DEDENT>except Exception as e:<EOL><INDENT>log.error("<STR_LIT>" % str(e))<EOL><DEDENT>
Format a crash report and send it somewhere relevant. There are two
    types of crashes: fatal crashes (backend errors) or non-fatal ones (just
    reporting a glitch, but the api call did not fail)