#NEWLINE# def register_archive_format( name , function , extra_args = None , description = '' ) : #NEWLINE# #INDENT# 'Registers an archive format.\n\n    name is the name of the format. function is the callable that will be\n    used to create archives. If provided, extra_args is a sequence of\n    (name, value) tuples that will be passed as arguments to the callable.\n    description can be provided to describe the format, and will be returned\n    by the get_archive_formats() function.\n    ' #NEWLINE# if ( extra_args is None ) : #NEWLINE# #INDENT# extra_args = [ ] #NEWLINE# #UNINDENT# if ( not isinstance ( function , collections . Callable ) ) : #NEWLINE# #INDENT# raise TypeError ( ( 'The %s object is not callable' % function ) ) #NEWLINE# #UNINDENT# if ( not isinstance ( extra_args , ( tuple , list ) ) ) : #NEWLINE# #INDENT# raise TypeError ( 'extra_args needs to be a sequence' ) #NEWLINE# #UNINDENT# for element in extra_args : #NEWLINE# #INDENT# if ( ( not isinstance ( element , ( tuple , list ) ) ) or ( len ( element ) != 2 ) ) : #NEWLINE# #INDENT# raise TypeError ( 'extra_args elements are : (arg_name, value)' ) #NEWLINE# #UNINDENT# #UNINDENT# _ARCHIVE_FORMATS [ name ] = ( function , extra_args , function )