code: def parse_transform(transform, direction='forward'):
      
      if hasattr(transform, '__call__'):
          tfun = transform
          tname = None
      elif hasattr(transform, 'lower'):
          tname = _get_canonical_name(transform)
          if tname is None:
              raise ValueError('Unknown transform: %s' % transform)
          else:
              tfun = name_transforms[tname][direction]
      else:
          raise TypeError('Unsupported transform type: %s' % type(transform))
      return tfun, tname
docs: direction : 'forward' | 'inverse'