original_docstring: 
          Recursive check if seted value is valid by template
  
          Args:
              template Union[Template, List[Template], Dict[str, Template]:
                  Template object or list of Templates or dict of Templates
              data Any: data for checking
  
          Raises:
              trafaret.DataError if data cant checked
              ValueError or more Exepitons if cant read or validate data
          
docstring: Recursive check if seted value is valid by template
  Args:
  template Union[Template, List[Template], Dict[str, Template]:
  Template object or list of Templates or dict of Templates
  data Any: data for checking
  
  trafaret.DataError if data cant checked
  ValueError or more Exepitons if cant read or validate data
docstring_tokens: Recursive check if seted value is valid by template Args : template Union [ Template List [ Template ] Dict [ str Template ] : Template object or list of Templates or dict of Templates data Any : data for checking trafaret . DataError if data cant checked ValueError or more Exepitons if cant read or validate data
code: def _check(
          self,
          template: Union[Template, List[Template], Dict[str, Template]],
          data: Any
      ):
          """
          Recursive check if seted value is valid by template
  
          Args:
              template Union[Template, List[Template], Dict[str, Template]:
                  Template object or list of Templates or dict of Templates
              data Any: data for checking
  
          Raises:
              trafaret.DataError if data cant checked
              ValueError or more Exepitons if cant read or validate data
          """
          if isinstance(template, list):
              result = []
              if len(template) == 1:
                  sub_template = template[0]
                  for value in data:
                      result.append(self._check(sub_template, value))
              else:
                  if len(template) != len(data):
                      raise ValueError("Invalid value length")
                  for inx, sub_template in enumerate(template):
                      next_data = data[inx]
                      result.append(self._check(sub_template, next_data))
              return result
  
          if isinstance(template, dict):
              result = {}
              for key, sub_template in template.items():
                  if key in data.keys():
                      result[key] = self._check(sub_template, data[key])
                  else:
                      if key not in self.optional_keys:
                          if isinstance(sub_template, Template):
                              if sub_template.default is not None:
                                  result[key] = sub_template.default
                              else:
                                  if not sub_template.optional:
                                      raise ValueError(f'Key "{key}" not set')
                          else:
                              raise ValueError(f'Key "{key}" not set')
              return result
          try:
              template.check(data)
          except DataError as e:
              if template.default is not None:
                  data = template.default
              else:
                  raise e
          return data
code_tokens: def _check ( self , template : Union [ Template , List [ Template ] , Dict [ str , Template ] ] , data : Any ) : if isinstance ( template , list ) : result = [ ] if len ( template ) == 1 : sub_template = template [ 0 ] for value in data : result . append ( self . _check ( sub_template , value ) ) else : if len ( template ) != len ( data ) : raise ValueError ( "Invalid value length" ) for inx , sub_template in enumerate ( template ) : next_data = data [ inx ] result . append ( self . _check ( sub_template , next_data ) ) return result if isinstance ( template , dict ) : result = { } for key , sub_template in template . items ( ) : if key in data . keys ( ) : result [ key ] = self . _check ( sub_template , data [ key ] ) else : if key not in self . optional_keys : if isinstance ( sub_template , Template ) : if sub_template . default is not None : result [ key ] = sub_template . default else : if not sub_template . optional : raise ValueError ( f'Key "{key}" not set' ) else : raise ValueError ( f'Key "{key}" not set' ) return result try : template . check ( data ) except DataError as e : if template . default is not None : data = template . default else : raise e return data
short_docstring: Recursive check if seted value is valid by template
  Args:
  template Union[Template, List[Template], Dict[str, Template]:
  Template object or list of Templates or dict of Templates
  data Any: data for checking
short_docstring_tokens: Recursive check if seted value is valid by template Args : template Union [ Template List [ Template ] Dict [ str Template ] : Template object or list of Templates or dict of Templates data Any : data for checking
comment: """
          Recursive check if seted value is valid by template
  
          Args:
              template Union[Template, List[Template], Dict[str, Template]:
                  Template object or list of Templates or dict of Templates
              data Any: data for checking
  
          Raises:
              trafaret.DataError if data cant checked
              ValueError or more Exepitons if cant read or validate data
          """