'Searches the datastore for a file.'

def _search_ds(self, method, *args, **kwargs):

    ds_path = kwargs.get('datastorePath')
    matched_files = set()
    directory = False
    dname = ('%s/' % ds_path)
    for file in _db_content.get('files'):
        if (file == dname):
            directory = True
            break
    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
