<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def list_leases(self, uuid=None):
 """ List current subnet leases Args: uuid(str):
 Filter the leases by uuid Returns: list of :class:~Lease: current leases """


        try:
            lease_files = os.listdir(self.path)
        except OSError as e:
            raise_from(
                LagoSubnetLeaseBadPermissionsException(self.path, e.strerror),
                e
            )

        leases = [
            self.create_lease_object_from_idx(lease_file.split('.')[0])
            for lease_file in lease_files if lease_file != LOCK_NAME
        ]
        if not uuid:
            return leases
        else:
            return [lease for lease in leases if lease.uuid == uuid]