def prefix_to_attr(attr_id):
 attr_by_prefix = {'fsmt-': 'MountTargetId', 'subnet-': 'SubnetId', 'eni-': 'NetworkInterfaceId', 'sg-': 'SecurityGroups'}
 prefix = first_or_default(filter((lambda pref: str(attr_id).startswith(pref)), attr_by_prefix.keys()))
 if prefix:
  return attr_by_prefix[prefix]
 return 'IpAddress'

def prefix_to_attr ( attr_id ) : attr_by_prefix = { 'fsmt-' : 'MountTargetId' , 'subnet-' : 'SubnetId' , 'eni-' : 'NetworkInterfaceId' , 'sg-' : 'SecurityGroups' } prefix = first_or_default ( filter ( ( lambda pref : str ( attr_id ) . startswith ( pref ) ) , attr_by_prefix . keys ( ) ) ) if prefix : return attr_by_prefix [ prefix ] return 'IpAddress'
helper method to convert id prefix to mount target attribute .