code: def file_manifest(self, location):
          
          #Maps file extensions to mimetypes
          mimetypes = {'.jpg': 'image/jpeg',
                       '.jpeg': 'image/jpeg',
                       '.xml': 'application/xhtml+xml',
                       '.png': 'image/png',
                       '.css': 'text/css',
                       '.ncx': 'application/x-dtbncx+xml',
                       '.gif': 'image/gif',
                       '.tif': 'image/tif',
                       '.pdf': 'application/pdf',
                       '.xhtml': 'application/xhtml+xml',
                       '.ttf': 'application/vnd.ms-opentype',
                       '.otf': 'application/vnd.ms-opentype'}
  
          current_dir = os.getcwd()
          os.chdir(location)
          for dirpath, _dirnames, filenames in os.walk('.'):
              dirpath = dirpath[2:]  # A means to avoid dirpath prefix of './'
              for fn in filenames:
                  fn_ext = os.path.splitext(fn)[-1]
                  item = etree.Element('item')
                  #Here we set three attributes: href, media-type, and id
                  if not dirpath:
                      item.attrib['href'] = fn
                  else:
                      item.attrib['href'] = '/'.join([dirpath, fn])
                  item.attrib['media-type'] = mimetypes[fn_ext]
                  #Special handling for common image types
                  if fn_ext in ['.jpg', '.png', '.tif', '.jpeg']:
                      #the following lines assume we are using the convention
                      #where the article doi is prefixed by 'images-'
                      item.attrib['id'] = '-'.join([dirpath[7:],
                                                    fn.replace('.', '-')])
                  else:
                      item.attrib['id'] = fn.replace('.', '-')
                  yield item
          os.chdir(current_dir)
docs: An iterator through the files in a location which yields item elements
          suitable for insertion into the package manifest.