@classmethod<EOL><INDENT>def _create_pax_generic_header(cls, pax_headers, type, encoding):<DEDENT>
<EOL>binary = False<EOL>for keyword, value in pax_headers.items():<EOL><INDENT>try:<EOL><INDENT>value.encode("<STR_LIT:utf8>", "<STR_LIT:strict>")<EOL><DEDENT>except UnicodeEncodeError:<EOL><INDENT>binary = True<EOL>break<EOL><DEDENT><DEDENT>records = b"<STR_LIT>"<EOL>if binary:<EOL><INDENT>records += b"<STR_LIT>"<EOL><DEDENT>for keyword, value in pax_headers.items():<EOL><INDENT>keyword = keyword.encode("<STR_LIT:utf8>")<EOL>if binary:<EOL><INDENT>value = value.encode(encoding, "<STR_LIT>")<EOL><DEDENT>else:<EOL><INDENT>value = value.encode("<STR_LIT:utf8>")<EOL><DEDENT>l = len(keyword) + len(value) + <NUM_LIT:3>   <EOL>n = p = <NUM_LIT:0><EOL>while True:<EOL><INDENT>n = l + len(str(p))<EOL>if n == p:<EOL><INDENT>break<EOL><DEDENT>p = n<EOL><DEDENT>records += bytes(str(p), "<STR_LIT:ascii>") + b"<STR_LIT:U+0020>" + keyword + b"<STR_LIT:=>" + value + b"<STR_LIT:\n>"<EOL><DEDENT>info = {}<EOL>info["<STR_LIT:name>"] = "<STR_LIT>"<EOL>info["<STR_LIT:type>"] = type<EOL>info["<STR_LIT:size>"] = len(records)<EOL>info["<STR_LIT>"] = POSIX_MAGIC<EOL>return cls._create_header(info, USTAR_FORMAT, "<STR_LIT:ascii>", "<STR_LIT:replace>") +cls._create_payload(records)<EOL>
Return a POSIX.1-2008 extended or global header sequence
           that contains a list of keyword, value pairs. The values
           must be strings.