Instead of cramming this in one line, why not define:

    def sortable_value(value):
        if isinstance(value, basestring):
            value = value.lower()
        return value

And then use as:

    return sorted(values.iterkeys(), key=sortable_value)

Or maybe:

    return sorted(sortable_value(x) for x in values.iterkeys())

I think that's more readable, no?