# Path: birdy/utils.py
# def is_file(path):
#     """Return True if `path` is a valid file."""
#     if not path:
#         ok = False
#     elif isinstance(path, Path):
#         p = path
#     else:
#         p = Path(path[:255])
#     try:
#         ok = p.is_file()
#     except Exception:
#         ok = False
#     return ok
# 
# def sanitize(name):
#     """Lower-case name and replace all non-ascii chars by `_`.
# 
#     If name is a Python keyword (like `return`) then add a trailing `_`.
#     """
#     new_name = re.sub(r"\W|^(?=\d)", "_", name.lower())
#     if keyword.iskeyword(new_name):
#         new_name = new_name + "_"
#     return new_name


import datetime as dt
import dateutil.parser
from pathlib import Path
from urllib.parse import urlparse
from owslib.wps import ComplexDataInput
from ..utils import is_file, sanitize
    """Whether or not to encode the value as raw data content.

    Returns True if
      - value is a file:/// URI or a local path
      - value is a File-like instance
      - url is not localhost
      - value is a File object
      - value is already the string content
    """
    if hasattr(value, "read"):  # File-like
        return True

    u = urlparse(url)

    if isinstance(value, Path):  # pathlib.Path
        p = value
        scheme = "file"
    else:  # String-like
        v = urlparse(value)
        p = Path(v.path)
        scheme = v.scheme

    if scheme == "file":  # Explicit link to file
        if is_file(p):
            return "localhost" not in u.netloc
        else:
            raise IOError(
                "{} should be a local file but was not found on disk.".format(value)
            )
    elif scheme == "":  # Could be a local path or just a string

# Path: birdy/utils.py
# def is_file(path):
#     """Return True if `path` is a valid file."""
#     if not path:
#         ok = False
#     elif isinstance(path, Path):
#         p = path
#     else:
#         p = Path(path[:255])
#     try:
#         ok = p.is_file()
#     except Exception:
#         ok = False
#     return ok
# 
# def sanitize(name):
#     """Lower-case name and replace all non-ascii chars by `_`.
# 
#     If name is a Python keyword (like `return`) then add a trailing `_`.
#     """
#     new_name = re.sub(r"\W|^(?=\d)", "_", name.lower())
#     if keyword.iskeyword(new_name):
#         new_name = new_name + "_"
#     return new_name


# Path: birdy/client/utils.py
import datetime as dt
import dateutil.parser
from pathlib import Path
from urllib.parse import urlparse
from owslib.wps import ComplexDataInput
from ..utils import is_file, sanitize

    """Whether or not to encode the value as raw data content.

    Returns True if
      - value is a file:/// URI or a local path
      - value is a File-like instance
      - url is not localhost
      - value is a File object
      - value is already the string content
    """
    if hasattr(value, "read"):  # File-like
        return True

    u = urlparse(url)

    if isinstance(value, Path):  # pathlib.Path
        p = value
        scheme = "file"
    else:  # String-like
        v = urlparse(value)
        p = Path(v.path)
        scheme = v.scheme

    if scheme == "file":  # Explicit link to file
        if is_file(p):
            return "localhost" not in u.netloc
        else:
            raise IOError(
                "{} should be a local file but was not found on disk.".format(value)
            )
    elif scheme == "":  # Could be a local path or just a string

        if is_file(p):