<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _take_lease(self, lease, uuid_path, safe=True):
 """ Persist the given lease to the store and make the prefix in uuid_path his owner Args: lease(lago.subnet_lease.Lease):
 Object representation of the lease uuid_path (str):
 Path to the prefix uuid safe (bool):
 If true (the default), validate the the lease isn't taken. Raises: LagoSubnetLeaseException: If safe == True and the lease is already taken. """

        if safe:
            lease_taken_by = self._lease_valid(lease)
            if lease_taken_by and lease_taken_by != uuid_path:
                raise LagoSubnetLeaseTakenException(
                    lease.subnet, lease_taken_by
                )

        with open(uuid_path) as f:
            uuid = f.read()
        with open(lease.path, 'wt') as f:
            utils.json_dump((uuid_path, uuid), f)

        LOGGER.debug(
            'Assigned subnet lease {} to {}'.format(lease.path, uuid_path)
        )