docs: def _parse_type(value, type_func):
          """
          Attempt to cast *value* into *type_func*, returning *default* if it fails.
          """
          default = type_func(0)
          if value is None:
              return default
          try:
              return type_func(value)
          except ValueError:
              return default