def strip_quotes(a):
   """Conditionally remove leading/trailing quotes from a string
   @type a: string
   @param a: a string potentially with quotes

   @rtype: string
   @return: same string without the leading and trailing quotes
   """
   ln = len(a)
   if ln >= 2:
      strip_quotes = False
      if a[0] == '"' and a[-1] == '"':
         strip_quotes=True
      elif a[0] == "'" and a[-1] == "'":
         strip_quotes=True
      if strip_quotes:
         b = a[1:ln-1]
         return b
   return a