'Initialize a resource allocator.
:param resource_name: A unique identifier for a pool of resources.
:param allocator_function: A function with no parameters that generates
a resource.
:param validator: An optional function that accepts a resource and an
existing pool and returns if the generated resource
is valid.'

def __init__(self, resource_name, allocator_function, validator=None):

    def is_valid(new_resource, allocated_resources):
        return (new_resource not in allocated_resources)
    self._allocator_function = allocator_function
    self._state_file_path = os.path.join(TMP_DIR, resource_name)
    self._validator = (validator if validator else is_valid)
    self._resource_name = resource_name
