'Throw exception if folder is not empty'

def check_folder_is_empty(self):

    files = frappe.get_all(u'File', filters={u'folder': self.name}, fields=(u'name', u'file_name'))
    if (self.is_folder and files):
        frappe.throw(_(u'Folder    {0}    is    not    empty').format(self.name), FolderNotEmpty)
