<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def process_text(text, citation=None, offline=False, output_fname=default_output_fname, timeout=None):
 """Return a ReachProcessor by processing the given text. Parameters text : str The text to be processed. citation : Optional[str] A PubMed ID passed to be used in the evidence for the extracted INDRA Statements. This is used when the text to be processed comes from a publication that is not otherwise identified. Default: None offline : Optional[bool] If set to True, the REACH system is ran offline. Otherwise (by default) the web service is called. Default: False output_fname : Optional[str] The file to output the REACH JSON output to. Defaults to reach_output.json in current working directory. timeout : Optional[float] This only applies when reading online (`offline=False`). Only wait for `timeout` seconds for the api to respond. Returns ------- rp : ReachProcessor A ReachProcessor containing the extracted INDRA Statements in rp.statements. """

    if offline:
        if not try_offline:
            logger.error('Offline reading is not available.')
            return None
        try:
            api_ruler = reach_reader.get_api_ruler()
        except ReachOfflineReadingError as e:
            logger.error(e)
            logger.error('Cannot read offline because the REACH ApiRuler '
                         'could not be instantiated.')
            return None
        try:
            result_map = api_ruler.annotateText(text, 'fries')
        except JavaException as e:
            logger.error('Could not process text.')
            logger.error(e)
            return None
        # REACH version < 1.3.3
        json_str = result_map.get('resultJson')
        if not json_str:
            # REACH version >= 1.3.3
            json_str = result_map.get('result')
        if not isinstance(json_str, bytes):
            json_str = json_str.encode('utf-8')
    else:
        data = {'text': text.encode('utf-8')}
        try:
            res = requests.post(reach_text_url, data, timeout=timeout)
        except requests.exceptions.RequestException as e:
            logger.error('Could not connect to REACH service:')
            logger.error(e)
            return None
        # TODO: we could use res.json() here to get a dict
        # directly
        # This is a byte string
        json_str = res.content
    if not isinstance(json_str, bytes):
        raise TypeError('{} is {} instead of {}'.format(json_str, json_str.__class__, bytes))

    with open(output_fname, 'wb') as fh:
        fh.write(json_str)
    return process_json_str(json_str.decode('utf-8'), citation)