conn = boto.connect_ec2()
my_eni_groups = conn.get_all_network_interfaces(['eni-1582af5d'])[0].groups
my_eni_sg_ids = [x.id for x in my_eni_groups]
add_sg = 'sg-xxxx1234'
if add_sg not in my_eni_sg_ids:
    my_eni_sg_ids.append(add_sg)
conn.modify_network_interface_attribute(interface_id=eni_id, attr=
    'groupSet', value=my_eni_sg_ids)
How do I add or remove security groups from ENIs using Boto?