<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def cleanup(self):
 """ Attempt to set a new current symlink if it is broken. If no other prefixes exist and the workdir is empty, try to delete the entire workdir. Raises: :exc:`~MalformedWorkdir`: if no prefixes were found, but the workdir is not empty. """


        current = self.join('current')
        if not os.path.exists(current):
            LOGGER.debug('found broken current symlink, removing: %s', current)
            os.unlink(self.join('current'))
            self.current = None
            try:
                self._update_current()
            except PrefixNotFound:
                if not os.listdir(self.path):
                    LOGGER.debug('workdir is empty, removing %s', self.path)
                    os.rmdir(self.path)
                else:
                    raise MalformedWorkdir(
                        (
                            'Unable to find any prefixes in {0}, '
                            'but the directory looks malformed. '
                            'Try deleting it manually.'
                        ).format(self.path)
                    )