def authorize_security_group(self, parameters, group, from_port, to_port,
    ip_protocol, cidr_ip):
    AppScaleLogger.log('Authorizing security group {0} for {1} traffic from ' \
      'port {2} to port {3}'.format(group, ip_protocol, from_port, to_port))
    conn = self.open_connection(parameters)
    retries_left = self.SECURITY_GROUP_RETRY_COUNT
    while retries_left:
      try:
        conn.authorize_security_group(group, from_port=from_port,
          to_port=to_port, ip_protocol=ip_protocol, cidr_ip=cidr_ip)
      except EC2ResponseError:
        pass
      try:
        group_info = conn.get_all_security_groups(group)[0]
        for rule in group_info.rules:
          if int(rule.from_port) == from_port and int(rule.to_port) == to_port \
            and rule.ip_protocol == ip_protocol:
            return
      except EC2ResponseError:
        pass
      time.sleep(self.SLEEP_TIME)
      retries_left -= 1

    raise AgentRuntimeException("Couldn't authorize {0} traffic from port " \
      "{1} to port {2} on CIDR IP {3}".format(ip_protocol, from_port, to_port,
      cidr_ip))
Subscription create requires javascript.
dataset/ETHPy150Open AppScale/appscale-tools/lib/agents/ec2_agent.py/EC2Agent.authorize_security_group--crossover with--dataset/ETHPy150Open nickjj/build-a-saas-app-with-flask/catwatch/tests/billing/test_views.py/TestBilling.test_subscription_create