regex = re.compile(
    """ # r'' means that \\n and the like is two chars
    ( 
      ^   
      .*  
      def 
      \\W* 
    ) 
    (\\w+) 
    \\W*   
    \\(    
      (.*)  
    \\)    
     :    
    """
    , re.VERBOSE | re.DEBUG)
Python RegEx Meaning