<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def create_policy(self, account, client, document, name, arn=None):
 """Create a new IAM policy. If the policy already exists, a new version will be added and if needed the oldest policy version not in use will be removed. Returns a dictionary containing the policy or version information Args: account (:obj:`Account`):
 Account to create the policy on client (:obj:`boto3.client`):
 A boto3 client object document (`str`):
 Policy document name (`str`):
 Name of the policy to create / update arn (`str`):
 Optional ARN for the policy to update Returns: `dict` """

        if not arn and not name:
            raise ValueError('create_policy must be called with either arn or name in the argument list')

        if arn:
            response = client.list_policy_versions(PolicyArn=arn)

            # If we're at the max of the 5 possible versions, remove the oldest version that is not
            # the currently active policy
            if len(response['Versions']) >= 5:
                version = [x for x in sorted(
                    response['Versions'],
                    key=lambda k: k['CreateDate']
                ) if not x['IsDefaultVersion']][0]

                self.log.info('Deleting oldest IAM Policy version {}/{}'.format(arn, version['VersionId']))
                client.delete_policy_version(PolicyArn=arn, VersionId=version['VersionId'])
                auditlog(
                    event='iam.check_roles.delete_policy_version',
                    actor=self.ns,
                    data={
                        'account': account.account_name,
                        'policyName': name,
                        'policyArn': arn,
                        'versionId': version['VersionId']
                    }
                )

            res = client.create_policy_version(
                PolicyArn=arn,
                PolicyDocument=document,
                SetAsDefault=True
            )
        else:
            res = client.create_policy(
                PolicyName=name,
                PolicyDocument=document
            )

        auditlog(
            event='iam.check_roles.create_policy',
            actor=self.ns,
            data={
                'account': account.account_name,
                'policyName': name,
                'policyArn': arn
            }
        )
        return res