<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def ParsePageVisitedRow( self, parser_mediator, query, row, cache=None, database=None, **unused_kwargs):
 """Parses a page visited row. Args: parser_mediator (ParserMediator):
 mediates interactions between parsers and other components, such as storage and dfvfs. query (str):
 query that created the row. row (sqlite3.Row):
 row. cache (Optional[SQLiteCache]):
 cache. database (Optional[SQLiteDatabase]):
 database. """

    query_hash = hash(query)

    from_visit = self._GetRowValue(query_hash, row, 'from_visit')
    hidden = self._GetRowValue(query_hash, row, 'hidden')
    rev_host = self._GetRowValue(query_hash, row, 'rev_host')
    typed = self._GetRowValue(query_hash, row, 'typed')

    # TODO: make extra conditional formatting.
    extras = []
    if from_visit:
      extras.append('visited from: {0:s}'.format(
          self._GetUrl(from_visit, cache, database)))

    if hidden == '1':
      extras.append('(url hidden)')

    if typed == '1':
      extras.append('(directly typed)')
    else:
      extras.append('(URL not typed directly)')

    event_data = FirefoxPlacesPageVisitedEventData()
    event_data.host = self._ReverseHostname(rev_host)
    event_data.offset = self._GetRowValue(query_hash, row, 'id')
    event_data.query = query
    event_data.title = self._GetRowValue(query_hash, row, 'title')
    event_data.url = self._GetRowValue(query_hash, row, 'url')
    event_data.visit_count = self._GetRowValue(query_hash, row, 'visit_count')
    event_data.visit_type = self._GetRowValue(query_hash, row, 'visit_type')

    if extras:
      event_data.extra = extras

    timestamp = self._GetRowValue(query_hash, row, 'visit_date')
    if timestamp:
      date_time = dfdatetime_posix_time.PosixTimeInMicroseconds(
          timestamp=timestamp)
      event = time_events.DateTimeValuesEvent(
          date_time, definitions.TIME_DESCRIPTION_LAST_VISITED)
      parser_mediator.ProduceEventWithEventData(event, event_data)