code: 
  """simple docstring"""
  import enum
  import inspect
  from typing import Iterable, List, Optional, Tuple, Union
  
  
  class    _lowerCAmelCase						(						enum.Enum						):
  							lowercase_     :     Dict       =							'''timm'''
  							lowercase_     :     str       =							'''transformers'''
  
  
  
  
  
  def     __lowerCamelCase  (		UpperCamelCase__				,     UpperCamelCase__				,     UpperCamelCase__      ):
  
  
  	"""simple docstring"""
  
  
  
  
  
  
  	if stage_names is None:
  		raise ValueError("Stage_names must be set for transformers backbones"      )
  
  	if out_features is not None:
  		if not isinstance(UpperCamelCase__				,     (list,)      ):
  			raise ValueError(f"out_features must be a list {type(UpperCamelCase__      )}"      )
  		if any(feat not in stage_names for feat in out_features      ):
  			raise ValueError(f"out_features must be a subset of stage_names: {stage_names} got {out_features}"      )
  
  	if out_indices is not None:
  		if not isinstance(UpperCamelCase__				,     (list, tuple)      ):
  			raise ValueError(f"out_indices must be a list or tuple, got {type(UpperCamelCase__      )}"      )
  		if any(idx >= len(UpperCamelCase__      ) for idx in out_indices      ):
  			raise ValueError("out_indices must be valid indices for stage_names {stage_names}, got {out_indices}"      )
  
  	if out_features is not None and out_indices is not None:
  		if len(UpperCamelCase__      ) != len(UpperCamelCase__      ):
  			raise ValueError("out_features and out_indices should have the same length if both are set"      )
  		if out_features != [stage_names[idx] for idx in out_indices]:
  			raise ValueError("out_features and out_indices should correspond to the same stages if both are set"      )
  
  
  
  
  def     __lowerCamelCase  (		UpperCamelCase__				,     UpperCamelCase__				,     UpperCamelCase__				,     ):
  
  
  	"""simple docstring"""
  
  
  
  
  
  
  	if out_indices is None and out_features is None:
  		_UpperCAmelCase =						[len(UpperCamelCase__      ) - 1]
  		_UpperCAmelCase =						[stage_names[-1]]
  	elif out_indices is None and out_features is not None:
  		_UpperCAmelCase =						[stage_names.index(UpperCamelCase__      ) for layer in out_features]
  	elif out_features is None and out_indices is not None:
  		_UpperCAmelCase =						[stage_names[idx] for idx in out_indices]
  	return out_features, out_indices
  
  
  
  
  def     __lowerCamelCase  (		UpperCamelCase__				,     UpperCamelCase__				,     UpperCamelCase__				,     ):
  
  
  	"""simple docstring"""
  
  
  
  
  
  
  	verify_out_features_out_indices(out_features=UpperCamelCase__				,     out_indices=UpperCamelCase__				,     stage_names=UpperCamelCase__      )
  	_UpperCAmelCase ,      _UpperCAmelCase =						_align_output_features_output_indices(
  	    out_features=UpperCamelCase__				,     out_indices=UpperCamelCase__				,     stage_names=UpperCamelCase__      )
  	# Verify that the aligned out_features and out_indices are valid
  	verify_out_features_out_indices(out_features=UpperCamelCase__				,     out_indices=UpperCamelCase__				,     stage_names=UpperCamelCase__      )
  	return output_features, output_indices
  
  
  class    _lowerCAmelCase						:
  							lowercase_     :     Optional[BackboneType]       =							None
  
  
  
  							def       _a   (      self ,						a_   )							->							None:
  								if getattr(self ,						"_backbone" ,						a_   ) is None:
  									raise ValueError("self._backbone must be set before calling _init_timm_backbone"   )
  
  								# These will diagree with the defaults for the transformers models e.g. for resnet50
  								# the transformer model has out_features = ['stem', 'stage1', 'stage2', 'stage3', 'stage4']
  								# the timm model has out_features = ['act', 'layer1', 'layer2', 'layer3', 'layer4']
  								_UpperCAmelCase =						[stage["module"] for stage in self._backbone.feature_info.info]
  								_UpperCAmelCase =						[stage["num_chs"] for stage in self._backbone.feature_info.info]
  								_UpperCAmelCase =						self._backbone.feature_info.out_indices
  								_UpperCAmelCase =						self._backbone.feature_info.module_name()
  
  								# We verify the out indices and out features are valid
  								verify_out_features_out_indices(
  								    out_features=a_ ,						out_indices=a_ ,						stage_names=self.stage_names   )
  								_UpperCAmelCase ,      _UpperCAmelCase =						out_features, out_indices
  
  
  
  							def       _a   (      self ,						a_   )							->							None:
  								_UpperCAmelCase =						getattr(a_ ,						"stage_names"   )
  								_UpperCAmelCase =						getattr(a_ ,						"out_features" ,						a_   )
  								_UpperCAmelCase =						getattr(a_ ,						"out_indices" ,						a_   )
  
  								_UpperCAmelCase =						stage_names
  								_UpperCAmelCase ,      _UpperCAmelCase =						get_aligned_output_features_output_indices(
  								    out_features=a_ ,						out_indices=a_ ,						stage_names=a_   )
  								# Number of channels for each stage. This is set in the transformer backbone model init
  								_UpperCAmelCase =						None
  
  
  
  							def       _a   (      self ,						a_   )							->							None:
  								_UpperCAmelCase =						config
  
  								_UpperCAmelCase =						getattr(a_ ,						"use_timm_backbone" ,						a_   )
  								_UpperCAmelCase =						BackboneType.TIMM if self.use_timm_backbone else BackboneType.TRANSFORMERS
  
  								if self.backbone_type == BackboneType.TIMM:
  									self._init_timm_backbone(a_   )
  								elif self.backbone_type == BackboneType.TRANSFORMERS:
  									self._init_transformers_backbone(a_   )
  								else:
  									raise ValueError(f"backbone_type {self.backbone_type} not supported."   )
  
  
  
  							@property
  							def       _a   (      self   )							->							Tuple:
  								return self._out_features
  
  
  
  							@out_features.setter
  							def       _a   (      self ,						a_   )							->							Any:
  								_UpperCAmelCase ,      _UpperCAmelCase =						get_aligned_output_features_output_indices(
  								    out_features=a_ ,						out_indices=a_ ,						stage_names=self.stage_names   )
  
  
  
  							@property
  							def       _a   (      self   )							->							str:
  								return self._out_indices
  
  
  
  							@out_indices.setter
  							def       _a   (      self ,						a_   )							->							List[Any]:
  								_UpperCAmelCase ,      _UpperCAmelCase =						get_aligned_output_features_output_indices(
  								    out_features=a_ ,						out_indices=a_ ,						stage_names=self.stage_names   )
  
  
  
  							@property
  							def       _a   (      self   )							->							Dict:
  								# the current backbones will output the number of channels for each stage
  								# even if that stage is not in the out_features list.
  								return {stage: self.num_features[i] for i, stage in enumerate(self.stage_names   )}
  
  
  
  							@property
  							def       _a   (      self   )							->							int:
  								return [self.out_feature_channels[name] for name in self.out_features]
  
  
  
  							def       _a   (      self ,						*a_ ,						**a_   )							->							Tuple:
  								_UpperCAmelCase =						dict(inspect.signature(self.forward   ).parameters   )
  								_UpperCAmelCase =						{k: v for k, v in kwargs.items() if k in signature}
  								return self(*a_ ,						**a_   )
  
  
  
  							def       _a   (      self ,						a_ ,						a_ = None ,						a_ = None ,						a_ = None ,						)							->							Any:
  								raise NotImplementedError("This method should be implemented by the derived class."   )
  
  
  
  							def       _a   (      self   )							->							int:
  								_UpperCAmelCase =						super().to_dict()
  								_UpperCAmelCase =						output.pop("_out_features"   )
  								_UpperCAmelCase =						output.pop("_out_indices"   )
  								return output
  
  
  
  
  
  class    _lowerCAmelCase						:
  
  
  
  							@property
  							def       _a   (      self   )							->							Optional[Any]:
  								return self._out_features
  
  
  
  							@out_features.setter
  							def       _a   (      self ,						a_   )							->							Dict:
  								_UpperCAmelCase ,      _UpperCAmelCase =						get_aligned_output_features_output_indices(
  								    out_features=a_ ,						out_indices=a_ ,						stage_names=self.stage_names   )
  
  
  
  							@property
  							def       _a   (      self   )							->							Tuple:
  								return self._out_indices
  
  
  
  							@out_indices.setter
  							def       _a   (      self ,						a_   )							->							str:
  								_UpperCAmelCase ,      _UpperCAmelCase =						get_aligned_output_features_output_indices(
  								    out_features=a_ ,						out_indices=a_ ,						stage_names=self.stage_names   )
  
  
  
  							def       _a   (      self   )							->							Union[str, Any]:
  								_UpperCAmelCase =						super().to_dict()
  								_UpperCAmelCase =						output.pop("_out_features"   )
  								_UpperCAmelCase =						output.pop("_out_indices"   )
  								return output
  
  
  
  
  
style_context: 
  """simple docstring"""
  def     __lowerCamelCase  (		UpperCamelCase__      ):
  
  
  	"""simple docstring"""
  
  
  
  
  
  
  	if not isinstance(UpperCamelCase__				,     UpperCamelCase__      ):
  		raise TypeError("recursive_lucas_number accepts only integer arguments."      )
  	if n_th_number == 0:
  		return 2
  	if n_th_number == 1:
  		return 1
  
  	return recursive_lucas_number(n_th_number - 1      ) + recursive_lucas_number(
  	    n_th_number - 2      )
  
  
  
  
  def     __lowerCamelCase  (		UpperCamelCase__      ):
  
  
  	"""simple docstring"""
  
  
  
  
  
  
  	if not isinstance(UpperCamelCase__				,     UpperCamelCase__      ):
  		raise TypeError("dynamic_lucas_number accepts only integer arguments."      )
  	_UpperCAmelCase ,      _UpperCAmelCase =						2, 1
  	for _ in range(UpperCamelCase__      ):
  		_UpperCAmelCase ,      _UpperCAmelCase =						b, a + b
  	return a
  
  
  if __name__ == "__main__":
  			from doctest import testmod
  
  			testmod()
  			__magic_name__		       =				int(input('''Enter the number of terms in lucas series:\n''').strip())
  			print('''Using recursive function to calculate lucas series:''')
  			print(''' '''.join(str(recursive_lucas_number(i)) for i in range(n)))
  			print('''\nUsing dynamic function to calculate lucas series:''')
  			print(''' '''.join(str(dynamic_lucas_number(i)) for i in range(n)))
  
  
  
  
  