'Add a new rule to this security group.
You need to pass in either src_group_name
OR ip_protocol, from_port, to_port,
and cidr_ip.  In other words, either you are authorizing another
group or you are authorizing some ip-based rule.
:type ip_protocol: string
:param ip_protocol: Either tcp | udp | icmp
:type from_port: int
:param from_port: The beginning port number you are enabling
:type to_port: int
:param to_port: The ending port number you are enabling
:type cidr_ip: string or list of strings
:param cidr_ip: The CIDR block you are providing access to.
See http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing
:type src_group: :class:`boto.ec2.securitygroup.SecurityGroup` or
:class:`boto.ec2.securitygroup.GroupOrCIDR`
:param src_group: The Security Group you are granting access to.
:rtype: bool
:return: True if successful.'

def authorize(self, ip_protocol=None, from_port=None, to_port=None, cidr_ip=None, src_group=None, dry_run=False):

    group_name = None
    if (not self.vpc_id):
        group_name = self.name
    group_id = None
    if self.vpc_id:
        group_id = self.id
    src_group_name = None
    src_group_owner_id = None
    src_group_group_id = None
    if src_group:
        cidr_ip = None
        src_group_owner_id = src_group.owner_id
        if (not self.vpc_id):
            src_group_name = src_group.name
        elif hasattr(src_group, 'group_id'):
            src_group_group_id = src_group.group_id
        else:
            src_group_group_id = src_group.id
    status = self.connection.authorize_security_group(group_name, src_group_name, src_group_owner_id, ip_protocol, from_port, to_port, cidr_ip, group_id, src_group_group_id, dry_run=dry_run)
    if status:
        if (not isinstance(cidr_ip, list)):
            cidr_ip = [cidr_ip]
        for single_cidr_ip in cidr_ip:
            self.add_rule(ip_protocol, from_port, to_port, src_group_name, src_group_owner_id, single_cidr_ip, src_group_group_id, dry_run=dry_run)
    return status
