def func_lineno(func):
 try:
  return func.compat_co_firstlineno
 except AttributeError:
  try:
   return func.func_code.co_firstlineno
  except AttributeError:
   return (-1)

def func_lineno ( func ) : try : return func . compat_co_firstlineno except AttributeError : try : return func . func_code . co_firstlineno except AttributeError : return ( - 1 )
get the line number of a function .