:return: True if the path is valid, else raise a ValueError with the
             specific error

def is_valid_path(path):
    """
    :return: True if the path is valid, else raise a ValueError with the
             specific error
    """
    if not path.startswith('/'):
        msg = 'Invalid path "%s". Paths need to start with "/".'
        raise ValueError(msg % path[:40])

    for c in ' \t':
        if c in path:
            msg = ('Invalid character "%s" found in path. Paths need to be'
                   ' URL-encoded.')
            raise ValueError(msg % c)

    return True