<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_sqs_policy(self, topic_name, topic_arn, topic_subs):
 """ This method creates the SQS policy needed for an SNS subscription. It also takes the ARN of the SQS queue and converts it to the URL needed for the subscription, as that takes a URL rather than the ARN. """

        t = self.template

        arn_endpoints = []
        url_endpoints = []
        for sub in topic_subs:
            arn_endpoints.append(sub["Endpoint"])
            split_endpoint = sub["Endpoint"].split(":")
            queue_url = "https://%s.%s.amazonaws.com/%s/%s" % (
                split_endpoint[2],  # literally "sqs"
                split_endpoint[3],  # AWS region
                split_endpoint[4],  # AWS ID
                split_endpoint[5],  # Queue name
            )
            url_endpoints.append(queue_url)

        policy_doc = queue_policy(topic_arn, arn_endpoints)

        t.add_resource(
            sqs.QueuePolicy(
                topic_name + "SubPolicy",
                PolicyDocument=policy_doc,
                Queues=url_endpoints,
            )
        )