code: def glob(self, patterns, exclude=None):
          
          if isinstance(patterns, string_types):
              patterns = [patterns]
          if isinstance(exclude, string_types):
              exclude = [exclude]
          matches = []
          for pattern in patterns:
              matches += fnmatch.filter(self.iterbranchnames(), pattern)
              if exclude is not None:
                  for exclude_pattern in exclude:
                      matches = [match for match in matches
                                 if not fnmatch.fnmatch(match, exclude_pattern)]
          return matches
docs: Return a list of branch names that match ``pattern``.
          Exclude all matched branch names which also match a pattern in
          ``exclude``. ``exclude`` may be a string or list of strings.
  
          Parameters
          ----------
          patterns: str or list
              branches are matched against this pattern or list of patterns where
              globbing is performed with '*'.
  
          exclude : str or list, optional (default=None)
              branches matching this pattern or list of patterns are excluded
              even if they match a pattern in ``patterns``.
  
          Returns
          -------
          matches : list
              List of matching branch names