# Path: internetarchive/auth.py
# class S3Auth(AuthBase):
# class S3PostAuth(AuthBase):
#     def __init__(self, access_key=None, secret_key=None):
#     def __call__(self, r):
#     def __init__(self, access_key=None, secret_key=None):
#     def __call__(self, r):
# 
# Path: internetarchive/utils.py
# def deep_update(d, u):
# def validate_s3_identifier(string):
# def needs_quote(s):
# def norm_filepath(fp):
# def get_md5(file_object):
# def chunk_generator(fp, chunk_size):
# def suppress_keyboard_interrupt_message():
#     def new_hook(type, value, traceback):
#     def __init__(self, iterable, size):
#     def read(self, size=-1):  # TBD: add buffer for `len(data) > size` case
#     def __len__(self):
#     def __init__(self, id_list_or_single_id, session):
#     def __len__(self):
#     def __getitem__(self, idx):
#     def __getattr__(self, name):
#     def __repr__(self):
# def get_s3_xml_text(xml_str):
#     def _get_tag_text(tag_name, xml_obj):
# def get_file_size(file_obj):
# def iter_directory(directory):
# def recursive_file_count(files, item=None, checksum=False):
# def is_dir(obj):
# def reraise_modify(caught_exc, append_msg, prepend=False):
# def remove_none(obj):
# def delete_items_from_dict(d, to_delete):
# def is_valid_metadata_key(name):
# def merge_dictionaries(dict0, dict1, keys_to_drop=None):
# def parse_dict_cookies(value):
# class InvalidIdentifierException(Exception):
# class IterableToFileAdapter:
# class IdentifierListAsItems:


from logging import getLogger
from datetime import datetime
from requests.exceptions import HTTPError
from internetarchive import auth
from internetarchive.utils import json
import collections

        :type comment: str
        :param comment: (optional) A reasonable explanation for why the
                        task is being submitted.

        :type priority: int
        :param priority: (optional) Task priority from 10 to -10
                         (default: 0).

        :type data: dict
        :param data: (optional) Extra POST data to submit with
                     the request. Refer to `Tasks API Request Entity
                     <https://archive.org/services/docs/api/tasks.html#request-entity>`_.

        :type headers: dict
        :param headers: (optional) Add additional headers to request.

        :rtype: :class:`requests.Response`
        """
        data = {} if not data else data
        data.update({'cmd': cmd, 'identifier': identifier})
        if comment:
            if 'args' in data:
                data['args']['comment'] = comment
            else:
                data['args'] = {'comment': comment}
        if priority:
            data['priority'] = priority
        r = self.session.post(self.url,
                              json=data,

# Path: internetarchive/auth.py
# class S3Auth(AuthBase):
# class S3PostAuth(AuthBase):
#     def __init__(self, access_key=None, secret_key=None):
#     def __call__(self, r):
#     def __init__(self, access_key=None, secret_key=None):
#     def __call__(self, r):
# 
# Path: internetarchive/utils.py
# def deep_update(d, u):
# def validate_s3_identifier(string):
# def needs_quote(s):
# def norm_filepath(fp):
# def get_md5(file_object):
# def chunk_generator(fp, chunk_size):
# def suppress_keyboard_interrupt_message():
#     def new_hook(type, value, traceback):
#     def __init__(self, iterable, size):
#     def read(self, size=-1):  # TBD: add buffer for `len(data) > size` case
#     def __len__(self):
#     def __init__(self, id_list_or_single_id, session):
#     def __len__(self):
#     def __getitem__(self, idx):
#     def __getattr__(self, name):
#     def __repr__(self):
# def get_s3_xml_text(xml_str):
#     def _get_tag_text(tag_name, xml_obj):
# def get_file_size(file_obj):
# def iter_directory(directory):
# def recursive_file_count(files, item=None, checksum=False):
# def is_dir(obj):
# def reraise_modify(caught_exc, append_msg, prepend=False):
# def remove_none(obj):
# def delete_items_from_dict(d, to_delete):
# def is_valid_metadata_key(name):
# def merge_dictionaries(dict0, dict1, keys_to_drop=None):
# def parse_dict_cookies(value):
# class InvalidIdentifierException(Exception):
# class IterableToFileAdapter:
# class IdentifierListAsItems:


# Path: internetarchive/catalog.py
from logging import getLogger
from datetime import datetime
from requests.exceptions import HTTPError
from internetarchive import auth
from internetarchive.utils import json
import collections


        :type comment: str
        :param comment: (optional) A reasonable explanation for why the
                        task is being submitted.

        :type priority: int
        :param priority: (optional) Task priority from 10 to -10
                         (default: 0).

        :type data: dict
        :param data: (optional) Extra POST data to submit with
                     the request. Refer to `Tasks API Request Entity
                     <https://archive.org/services/docs/api/tasks.html#request-entity>`_.

        :type headers: dict
        :param headers: (optional) Add additional headers to request.

        :rtype: :class:`requests.Response`
        """
        data = {} if not data else data
        data.update({'cmd': cmd, 'identifier': identifier})
        if comment:
            if 'args' in data:
                data['args']['comment'] = comment
            else:
                data['args'] = {'comment': comment}
        if priority:
            data['priority'] = priority
        r = self.session.post(self.url,
                              json=data,

                              auth=self.auth,