docs: def cast_type(self, var, cast_type=None):
          """
          cast the value into the type typ
          if type is not provided it is set to self.valid_values
          Args:
              var: variable to be cast
              type: target type
  
          Returns: the variable var csat into type typ
  
          """
  
          if cast_type is None:
              cast_type = self.valid_values
  
          try:
              if cast_type == int:
                  return int(var)
              elif cast_type == float:
                  return float(var)
              elif type == str:
                  return str(var)
              elif isinstance(cast_type, list):
                  # cast var to be of the same type as those in the list
                  return type(cast_type[0])(var)
              else:
                  return None
          except ValueError:
              return None
  
          return var