def __FormatResult(filepath, line_index, context=3, lines = None):

  # If modules are found (the file itself), return only the filename.
  filepath = U.GetRelativeFilePath(filepath)
  if line_index is -1:
    return "%s:0:"%(filepath)

  if lines is None:
    fp = open(filepath)
    lines = fp.readlines()
    fp.close()

  if len(lines) is 0:
    return "%s:0:"%(filepath)

  if context is 0:
    return "%s:%d:%s"%(filepath, line_index+1, lines[line_index][:-1])

  # When there is a context
  max_line_number_size = len(str(line_index+context+1)) # Max line number length

  low  = max(line_index - context, 0)
  high = min(line_index + context+1, len(lines)-1)

  before = [__FormatLine(filepath, i, max_line_number_size, lines)
      for i in range(low,line_index)]

  after  = [__FormatLine(filepath, i, max_line_number_size, lines)
      for i in range(line_index+1,high)]

  current = __FormatLine(filepath, line_index, max_line_number_size,
      lines, highlight=True)

  return "".join(before + [current] + after)
make a nice homepage dashboard with the commands and latest runs
dataset/ETHPy150Open spranesh/Redhawk/redhawk/common/format_position.py/__FormatResult--crossover with--dataset/ETHPy150Open garethr/Asteroid/asteroid/apps/runner/views.py/dashboard