<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def check_allocate_ip(self, obj, direc):
 """This function allocates a subnet from the pool. It first checks to see if Openstack is already using the subnet. If yes, it retries until it finds a free subnet not used by Openstack. """

        subnet_lst = self.os_helper.get_all_subnets_cidr(no_mask=True)
        ip_next = obj.allocate_subnet(subnet_lst)
        if ip_next is None:
            LOG.error("Unable to allocate a subnet for direction %s",
                      direc)
        return ip_next