<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def get_checkout_target(self):
        '''
        Resolve dynamically-set branch
        '''
        if self.role == 'git_pillar' and self.branch == '__env__':
            try:
                return self.all_saltenvs
            except AttributeError:
                # all_saltenvs not configured for this remote
                pass
            target = self.opts.get('pillarenv') \
                or self.opts.get('saltenv') \
                or 'base'
            return self.base \
                if target == 'base' \
                else six.text_type(target)
        return self.branch