def create_secgroup_rule(self, protocol, from_port, to_port,
            source, target):
        """
        Creates a new server security group rule.

        :param str protocol:  E.g. ``tcp``, ``icmp``, etc...
        :param int from_port:  E.g. ``1``
        :param int to_port:  E.g. ``65535``
        :param str source:
        :param str target:  The target security group.  I.e. the group in which
            this rule should be created.

        """
        kwargs = {
            'ip_protocol': protocol,
            'from_port': from_port,
            'to_port': to_port
        }
        sg = self.find_secgroup(target).ec2sg
        if not sg:
            raise BangError("Security group not found, %s" % target)
        if '/' in source:
            # Treat as cidr (/ is mask)
            kwargs['cidr_ip'] = source
        else:
            kwargs['src_group'] = self.find_secgroup(source).ec2sg
        sg.authorize(**kwargs)
Creates a new server security group rule.

        :param str protocol:  E.g. ``tcp``, ``icmp``, etc...
        :param int from_port:  E.g. ``1``
        :param int to_port:  E.g. ``65535``
        :param str source:
        :param str target:  The target security group.  I.e. the group in which
            this rule should be created.