code: def get_linenos(obj):
      
      try:
          lines, start = inspect.getsourcelines(obj)
      except TypeError:
          return None, None
      else:
          return start, start + len(lines) - 1
docs: Get an object’s line numbers