docs: def translate(value):
      """
      Translates given schema from "pythonic" syntax to a validator.
  
      Usage::
  
          >>> translate(str)
          IsA(str)
  
          >>> translate('hello')
          IsA(str, default='hello')
  
      """
      if isinstance(value, BaseValidator):
          return value
  
      if value is None:
          return Anything()
  
      if isinstance(value, type):
          return IsA(value)
  
      if type(value) in compat.func_types:
          real_value = value()
          return IsA(type(real_value), default=real_value)
  
      if isinstance(value, list):
          if value == []:
              # no inner spec, just an empty list as the default value
              return IsA(list)
          elif len(value) == 1:
              # the only item as spec for each item of the collection
              return ListOf(translate(value[0]))
          else:
              raise StructureSpecificationError(
                  'Expected a list containing exactly 1 item; '
                  'got {cnt}: {spec}'.format(cnt=len(value), spec=value))
  
      if isinstance(value, dict):
          if not value:
              return IsA(dict)
          items = []
          for k, v in value.items():
              if isinstance(k, BaseValidator):
                  k_validator = k
              else:
                  k_validator = translate(k)
                  default = k_validator.get_default_for(None)
                  if default is not None:
                      k_validator = Equals(default)
              v_validator = translate(v)
              items.append((k_validator, v_validator))
          return DictOf(items)
  
      return IsA(type(value), default=value)