code: def validate_reference(self, reference: ReferenceDefinitionType) -> Optional[Path]:
          
          if reference is not None:
              if isinstance(reference, bytes):
                  reference = reference.decode("utf-8")
              try:
                  return Path(reference)
              except TypeError:
                  raise ValueError(f"Can't convert reference path {reference} to a pathlib.Path")
  
          return None
docs: Converts reference to :class:`Path <pathlib.Path>`
  
          :raise ValueError: If ``reference`` can't be converted to :class:`Path <pathlib.Path>`.