from collections import OrderedDict def glue(*args, **kwargs): what_to_glue = list(args) kwargs = OrderedDict(sorted(kwargs.items(), key=lambda t: t[0])) # I dont care what order you submit them in, they will be alphabetical what_to_glue.extend([v for k,v in kwargs.iteritems()]) # Ignore all your keys, because you're doing this wrong anyway return " ".join(what_to_glue)