Helper method for screening keyword arguments

def ok_kwarg(val):
        """Helper method for screening keyword arguments"""

        import keyword

        try:
            return str.isidentifier(val) and not keyword.iskeyword(val)
        except TypeError:
            # Non-string values are never a valid keyword arg
            return False