def acquire(self, uuid_path, subnet=None):
try:<EOL><INDENT>with self._create_lock():<EOL><INDENT>if subnet:<EOL><INDENT>LOGGER.debug('<STR_LIT>'.format(subnet))<EOL>acquired_subnet = self._acquire_given_subnet(<EOL>uuid_path, subnet<EOL>)<EOL><DEDENT>else:<EOL><INDENT>LOGGER.debug('<STR_LIT>')<EOL>acquired_subnet = self._acquire(uuid_path)<EOL><DEDENT>return acquired_subnet<EOL><DEDENT><DEDENT>except (utils.TimerException, IOError):<EOL><INDENT>raise LagoSubnetLeaseLockException(self.path)<EOL><DEDENT>
Lease a free subnet for the given uuid path.
If subnet is given, try to lease that subnet, otherwise try to lease a
free subnet.

Args:
    uuid_path (str): Path to the uuid file of a :class:`lago.Prefix`
    subnet (str): A subnet to lease.
Returns:
    netaddr.IPAddress: An object which represents the subnet.

Raises:
    LagoSubnetLeaseException:
        1. If this store is full
        2. If the requested subnet is already taken.
    LagoSubnetLeaseLockException:
        If the lock to self.path can't be acquired.