def path(value,
         allow_empty = False,
         **kwargs):
    """Validate that ``value`` is a valid path-like object.

    :param value: The value to validate.

    :param allow_empty: If ``True``, returns :obj:`None <python:None>` if
      ``value`` is empty. If ``False``, raises a
      :class:`EmptyValueError <validator_collection.errors.EmptyValueError>`
      if ``value`` is empty. Defaults to ``False``.
    :type allow_empty: :class:`bool <python:bool>`

    :returns: The path represented by ``value``.
    :rtype: Path-like object / :obj:`None <python:None>`

    :raises EmptyValueError: if ``allow_empty`` is ``False`` and ``value`` is empty
    :raises NotPathlikeError: if ``value`` is not a valid path-like object

    """
    if not value and not allow_empty:
        raise errors.EmptyValueError('value (%s) was empty' % value)
    elif not value:
        return None

    if hasattr(os, 'PathLike'):
        if not isinstance(value, (str, bytes, int, os.PathLike)):                    # pylint: disable=E1101
            raise errors.NotPathlikeError('value (%s) is path-like' % value)
    else:
        if not isinstance(value, int):
            try:
                os.path.exists(value)
            except TypeError:
                raise errors.NotPathlikeError('value (%s) is not path-like' % value)

    return value
Validate that ``value`` is a valid path-like object.

    :param value: The value to validate.

    :param allow_empty: If ``True``, returns :obj:`None <python:None>` if
      ``value`` is empty. If ``False``, raises a
      :class:`EmptyValueError <validator_collection.errors.EmptyValueError>`
      if ``value`` is empty. Defaults to ``False``.
    :type allow_empty: :class:`bool <python:bool>`

    :returns: The path represented by ``value``.
    :rtype: Path-like object / :obj:`None <python:None>`

    :raises EmptyValueError: if ``allow_empty`` is ``False`` and ``value`` is empty
    :raises NotPathlikeError: if ``value`` is not a valid path-like object