def dequote(arg): "Given a list, will return a list with any leading and trailing quotes from the items in the list removed" return [ ( arg[1:-1] if arg[0] == arg[-1] and arg[0] in ('"', "'") else arg ) for arg in args ]