docs: def apply_transformations(collection, transformations, select=None):
      ''' Apply all transformations to the variables in the collection.
  
      Args:
          transformations (list): List of transformations to apply.
          select (list): Optional list of names of variables to retain after all
              transformations are applied.
      '''
      for t in transformations:
          kwargs = dict(t)
          func = kwargs.pop('name')
          cols = kwargs.pop('input', None)
  
          if isinstance(func, string_types):
              if func in ('and', 'or'):
                  func += '_'
              if not hasattr(transform, func):
                  raise ValueError("No transformation '%s' found!" % func)
              func = getattr(transform, func)
              func(collection, cols, **kwargs)
  
      if select is not None:
          transform.Select(collection, select)
  
      return collection