def merge_by_average(hars):
  logs = map(lambda har: har['log'], hars)

  os_info_first = logs[0]['_os']
  browser_info_first = logs[0]['browser']
  creator_first = logs[0]['creator']
  assert all(log['_os'] == os_info_first and
             log['browser'] == browser_info_first and
             log['creator'] == creator_first for log in logs)

  avg_har = {"log": {}}
  avg_log = avg_har["log"]

  avg_log['_os'] = os_info_first
  avg_log['creator'] = creator_first
  avg_log['browser'] = browser_info_first
  avg_log['version'] = logs[0]['version']

  sorted(logs, key=lambda log: log['pages'][0]['pageTimings']['onLoad'])
  median_onload_log = logs[len(logs) / 2]

  avg_log['entries'] = median_onload_log['entries']

  avg_log['pages'] = []
  avg_log['pages'].append({})

  avg_log['pages'][0]['_cssStats'] = avg_css_stats([log['pages'][0]['_cssStats'] for log in logs])
  avg_log['pages'][0]['_memoryStats'] = avg_memory_stats([log['pages'][0]['_memoryStats'] for log in logs])
  avg_log['pages'][0]['_eventStats'] = avg_event_stats([log['pages'][0]['_eventStats'] for log in logs])
  avg_log['pages'][0]['_domNodeStats'] = median_onload_log['pages'][0]['_domNodeStats']
  avg_log['pages'][0]['pageTimings'] = median_onload_log['pages'][0]['pageTimings']

  for field, value in median_onload_log['pages'][0].iteritems():
    if type(value) == type("") or type(value) == type(u""):
      avg_log['pages'][0][field] = value


  return avg_har
Returns a har file representing the average of multiple har files, each reprenting the same page request. The har
dataset/ETHPy150Open linkedin/mobster/src/linkedin/mobster/har/merge.py/merge_by_average