def _update_current(self):
        """
        Makes sure that a current is set
        """
        if not self.current or self.current not in self.prefixes:
            if 'default' in self.prefixes:
                selected_current = 'default'
            elif self.prefixes:
                selected_current = sorted(self.prefixes.keys()).pop()
            else:
                # should never get here
                raise MalformedWorkdir(
                    'No current link and no prefixes in workdir %s' % self.path
                )

            logging.info(
                'Missing current link, setting it to %s',
                selected_current,
            )
            self._set_current(selected_current)
Makes sure that a current is set