def list_policies(iot_client, old_certificate_arn):
    """
    Creates a list of all the policies attached to the old certificate
    :param iot_client: the boto client to connect and execute
    IoT APIs
    :param old_certificate_arn: the old certificate arn
    :return: list of policies
    """
    policy_list = []
    response = iot_client.list_attached_policies(
        target=old_certificate_arn
    )
    policy_list.append(response['policies'])

    while 'nextMarker' in response:
        response = iot_client.list_attached_policies(
            marker=response['nextMarker'],
            target=old_certificate_arn
        )
        policy_list.append(response['policies'])

    return policy_list