

def _validate_file_or_path(file_or_path, obj_name):
    if isinstance(file_or_path, six.string_types):
        if (not os.path.exists(file_or_path)):
            raise exc.FileNotFound(("The file '%s' does not exist." % file_or_path))
        fname = os.path.basename(file_or_path)
    else:
        try:
            fname = os.path.basename(file_or_path.name)
        except AttributeError:
            fname = None
    return (obj_name or fname)

dataset/ETHPy150Open rackspace/pyrax/pyrax/object_storage.py _validate_file_or_path/original