def _get_line_index(line_or_func, lines):
 if hasattr(line_or_func, '__call__'):
  return line_or_func(lines)
 elif line_or_func:
  if (line_or_func >= 0):
   return line_or_func
  else:
   n_lines = sum((1 for line in lines))
   return (n_lines + line_or_func)
 else:
  return line_or_func

def _get_line_index ( line_or_func , lines ) : if hasattr ( line_or_func , '__call__' ) : return line_or_func ( lines ) elif line_or_func : if ( line_or_func >= 0 ) : return line_or_func else : n_lines = sum ( ( 1 for line in lines ) ) return ( n_lines + line_or_func ) else : return line_or_func
return the appropriate line index .