def _search_ds(self, method, *args, **kwargs):
        """Searches the datastore for a file."""
        # TODO(garyk): add support for spec parameter
        ds_path = kwargs.get("datastorePath")
        matched_files = set()
        # Check if we are searching for a file or a directory
        directory = False
        dname = '%s/' % ds_path
        for file in _db_content.get("files"):
            if file == dname:
                directory = True
                break
        # A directory search implies that we must return all
        # subdirectories
        if directory:
            for file in _db_content.get("files"):
                if file.find(ds_path) != -1:
                    if not file.endswith(ds_path):
                        path = file.replace(dname, '', 1).split('/')
                        if path:
                            matched_files.add(path[0])
            if not matched_files:
                matched_files.add('/')
        else:
            for file in _db_content.get("files"):
                if file.find(ds_path) != -1:
                    matched_files.add(ds_path)
        if matched_files:
            result = DataObject()
            result.path = ds_path
            result.file = []
            for file in matched_files:
                matched = DataObject()
                matched.path = file
                matched.fileSize = 1024
                result.file.append(matched)
            task_mdo = create_task(method, "success", result=result)
        else:
            task_mdo = create_task(method, "error", error_fault=FileNotFound())
        return task_mdo.obj
dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/tests/unit/virt/vmwareapi/fake.py/FakeVim._search_ds/original