def _search_folder_for_item_or_folder(name, folder_id):
session.token = verify_credentials()<EOL>children = session.communicator.folder_children(session.token, folder_id)<EOL>for folder in children['<STR_LIT>']:<EOL><INDENT>if folder['<STR_LIT:name>'] == name:<EOL><INDENT>return False, folder['<STR_LIT>']  <EOL><DEDENT><DEDENT>for item in children['<STR_LIT>']:<EOL><INDENT>if item['<STR_LIT:name>'] == name:<EOL><INDENT>return True, item['<STR_LIT>']  <EOL><DEDENT><DEDENT>return False, -<NUM_LIT:1><EOL>
Find an item or folder matching the name. A folder will be found first if
both are present.

:param name: The name of the resource
:type name: string
:param folder_id: The folder to search within
:type folder_id: int | long
:returns: A tuple indicating whether the resource is an item an the id of
    said resource. i.e. (True, item_id) or (False, folder_id). Note that in
    the event that we do not find a result return (False, -1)
:rtype: (bool, int | long)