def enum(**enums):
    """
    Define an enum type creator.
    usage:
        directions = enum(UP = 1, DOWN = 2)
        assert direction.UP == 1
        assert direction.DOWN == 2
    """
    return type('Enum', (object,), enums)