def fetch_dhcp_options_for_vpc(vpc_conn, vpc_id):
 vpcs = vpc_conn.get_all_vpcs(vpc_ids=[vpc_id])
 if ((len(vpcs) != 1) or (vpcs[0].dhcp_options_id == 'default')):
  return None
 dhcp_options = vpc_conn.get_all_dhcp_options(dhcp_options_ids=[vpcs[0].dhcp_options_id])
 if (len(dhcp_options) != 1):
  return None
 return dhcp_options[0]

def fetch_dhcp_options_for_vpc ( vpc_conn , vpc_id ) : vpcs = vpc_conn . get_all_vpcs ( vpc_ids = [ vpc_id ] ) if ( ( len ( vpcs ) != 1 ) or ( vpcs [ 0 ] . dhcp_options_id == 'default' ) ) : return None dhcp_options = vpc_conn . get_all_dhcp_options ( dhcp_options_ids = [ vpcs [ 0 ] . dhcp_options_id ] ) if ( len ( dhcp_options ) != 1 ) : return None return dhcp_options [ 0 ]
returns the dhcp options object currently associated with the requested vpc id using the vpc connection variable .