code: def regexp_error_msg(pattern):
      
      try:
          re.compile(pattern)
      except re.error as e:
          return str(e)
      return None
docs: Return None if the pattern is a valid regular expression or
      a string describing why the pattern is invalid.