def get_provider(self):
        '''
        Determine which provider to use
        '''
        if 'verified_{0}_provider'.format(self.role) in self.opts:
            self.provider = self.opts['verified_{0}_provider'.format(self.role)]
        else:
            desired_provider = self.opts.get('{0}_provider'.format(self.role))
            if not desired_provider:
                if self.verify_pygit2(quiet=True):
                    self.provider = 'pygit2'
                elif self.verify_gitpython(quiet=True):
                    self.provider = 'gitpython'
                elif self.verify_dulwich(quiet=True):
                    self.provider = 'dulwich'
            else:
                # Ensure non-lowercase providers work
                try:
                    desired_provider = desired_provider.lower()
                except __HOLE__:
                    # Should only happen if someone does something silly like
                    # set the provider to a numeric value.
                    desired_provider = str(desired_provider).lower()
                if desired_provider not in self.valid_providers:
                    log.critical(
                        'Invalid {0}_provider \'{1}\'. Valid choices are: {2}'
                        .format(self.role,
                                desired_provider,
                                ', '.join(self.valid_providers))
                    )
                    failhard(self.role)
                elif desired_provider == 'pygit2' and self.verify_pygit2():
                    self.provider = 'pygit2'
                elif desired_provider == 'gitpython' and self.verify_gitpython():
                    self.provider = 'gitpython'
                elif desired_provider == 'dulwich' and self.verify_dulwich():
                    self.provider = 'dulwich'
        if not hasattr(self, 'provider'):
            log.critical(
                'No suitable {0} provider module is installed.'
                .format(self.role)
            )
            failhard(self.role)
        if self.provider == 'pygit2':
            self.provider_class = Pygit2
        elif self.provider == 'gitpython':
            self.provider_class = GitPython
        elif self.provider == 'dulwich':
            self.provider_class = Dulwich
dataset/ETHPy150Open saltstack/salt/salt/utils/gitfs.py/GitBase.get_provider