def _reformat_policy(policy):
policy_name = policy['<STR_LIT>']<EOL>ret = {}<EOL>ret['<STR_LIT:type>'] = policy['<STR_LIT>']<EOL>attrs = policy['<STR_LIT>']<EOL>if ret['<STR_LIT:type>'] != '<STR_LIT>':<EOL><INDENT>return policy_name, ret<EOL><DEDENT>attributes = dict()<EOL>for attr in attrs:<EOL><INDENT>attributes[attr['<STR_LIT>']] = attr['<STR_LIT>']<EOL><DEDENT>ret['<STR_LIT>'] = dict()<EOL>ret['<STR_LIT>']['<STR_LIT>'] = bool(attributes.get('<STR_LIT>'))<EOL>ret['<STR_LIT>']['<STR_LIT>'] = bool(attributes.get('<STR_LIT>'))<EOL>ret['<STR_LIT>']['<STR_LIT>'] = bool(attributes.get('<STR_LIT>'))<EOL>ret['<STR_LIT>']['<STR_LIT>'] = bool(attributes.get('<STR_LIT>'))<EOL>ret['<STR_LIT>']['<STR_LIT>'] = bool(attributes.get('<STR_LIT>'))<EOL>ret['<STR_LIT>'] = bool(attributes.get('<STR_LIT>'))<EOL>ret['<STR_LIT>'] = attributes.get('<STR_LIT>', None)<EOL>non_ciphers = [<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>'<EOL>]<EOL>ciphers = []<EOL>for cipher in attributes:<EOL><INDENT>if attributes[cipher] == '<STR_LIT:true>' and cipher not in non_ciphers:<EOL><INDENT>ciphers.append(cipher)<EOL><DEDENT><DEDENT>ciphers.sort()<EOL>ret['<STR_LIT>'] = ciphers<EOL>return policy_name, ret<EOL>
Policies returned from boto3 are massive, ugly, and difficult to read.
This method flattens and reformats the policy.

:param policy: Result from invoking describe_load_balancer_policies(...)
:return: Returns a tuple containing policy_name and the reformatted policy dict.