docs: def factory(raw_data, request):
      """Class factory to create different types of shades
      depending on shade type."""
      if ATTR_SHADE in raw_data:
          raw_data = raw_data.get(ATTR_SHADE)
  
      shade_type = raw_data.get(ATTR_TYPE)
  
      def find_type(shade):
          for tp in shade.shade_types:
              if tp.shade_type == shade_type:
                  return shade(raw_data, tp, request)
          return None
  
      _shade = find_type(ShadeTdbu)
      if _shade:
          return _shade
  
      _shade = find_type(ShadeBottomUp)
      if _shade:
          return _shade
  
      _shade = find_type(ShadeBottomUpTilt)
      if _shade:
          return _shade
  
      _shade = find_type(ShadeBottomUpTiltAnywhere)
      if _shade:
          return _shade
  
      _shade = find_type(Silhouette)
      if _shade:
          return _shade
  
      return BaseShade(raw_data, BaseShade.shade_types[0], request)