<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def numa_nodemask_to_set(mask):
 """ Convert NUMA nodemask to Python set. """

    result = set()

    for i in range(0, get_max_node() + 1):
        if __nodemask_isset(mask, i):
            result.add(i)

    return result