code: def files(self, entity_id, manifest=None, filename=None,
                read_file=False, channel=None):
          '''
          Get the files or file contents of a file for an entity.
          If all files are requested, a dictionary of filenames and urls for the
          files in the archive are returned.
          If filename is provided, the url of just that file is returned, if it
          exists.
          If filename is provided and read_file is true, the *contents* of the
          file are returned, if the file exists.
          @param entity_id The id of the entity to get files for
          @param manifest The manifest of files for the entity. Providing this
              reduces queries; if not provided, the manifest is looked up in the
              charmstore.
          @param filename The name of the file in the archive to get.
          @param read_file Whether to get the url for the file or the file
              contents.
          @param channel Optional channel name.
          '''
          if manifest is None:
              manifest_url = '{}/{}/meta/manifest'.format(self.url,
                                                          _get_path(entity_id))
              manifest_url = _add_channel(manifest_url, channel)
              manifest = self._get(manifest_url)
              manifest = manifest.json()
          files = {}
          for f in manifest:
              manifest_name = f['Name']
              file_url = self.file_url(_get_path(entity_id), manifest_name,
                                       channel=channel)
              files[manifest_name] = file_url
          if filename:
              file_url = files.get(filename, None)
              if file_url is None:
                  raise EntityNotFound(entity_id, filename)
              if read_file:
                  data = self._get(file_url)
                  return data.text
              else:
                  return file_url
          else:
              return files