title: Insert docstring attributes in a python file
body: <p>We are using napolean style docstring for python modules. But there is a need to auto populate additional attributes in the docstring called <code>Data Owner</code> and <code>DAL Owner</code> so that the given function looks like this:</p>
  
  <pre><code>def func(self, arg1=None, arg2=None):
  """
  Returns the timeseries for the specified arg1 and arg2.
  Args:
      arg1: argument 1
      arg2: argument 2
  Returns:
      DataFrame containing timeseries of arg1 for arg2.
  
  DAL Owner: Team IT
  Data Owner: Team A
  """
  </code></pre>
  
  <p>These additional attributes and their values for a given function are provided in a separate csv file. The way I was thinking was to have a script (awk, sed?) that will </p>
  
  <ul>
  <li>extract all the function names in a given python file. Can easily do it in python</li>
  <li>for those function names, check if the owners exist in the csv file and if so create a mapping of the function name and owners. Doable</li>
  </ul>
  
  <p>Now, this is the part which I havent figured out and dont know the best way forward. For a given function name and owners, I need to go back into the python file and add the owners to the docstring if it exists. I am thinking some sort of awk script but not quite sure</p>
  
  <ul>
  <li>Find the function that matches the pattern</li>
  <li>For that pattern, see if doctsring exists, triple quotation marks after closing parenthesis</li>
  <li>If docstring exists, add additional two lines for the owners before the closing triple quotation</li>
  <li>If docstring does not exists, then insert the two lines for owners between tripe quotations on the line after function declaration.</li>
  </ul>
  
  <p>I know this is a lot of steps but can anyone provide insight with the previous 4 bullet points to insert the additional attributes to docstring given the function, attributes and the python file. Will a linux utility like sed, awk be more useful or should I go the python route. Is there some other option that's easier to implement.</p>