<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def ParseFileObject(self, parser_mediator, file_object):
 """Parses an Opera global history file-like object. Args: parser_mediator (ParserMediator):
 mediates interactions between parsers and other components, such as storage and dfvfs. file_object (dfvfs.FileIO):
 file-like object. Raises: UnableToParseFile: when the file cannot be parsed. """

    encoding = self._ENCODING or parser_mediator.codepage
    text_file_object = text_file.TextFile(file_object, encoding=encoding)
    if not self._ParseAndValidateRecord(parser_mediator, text_file_object):
      raise errors.UnableToParseFile(
          'Unable to parse as Opera global_history.dat.')

    while self._ParseRecord(parser_mediator, text_file_object):
      pass