Returns the SubnetId of a SubnetName to use

def _get_subnetname_id(subnetname):
    '''
    Returns the SubnetId of a SubnetName to use
    '''
    params = {'Action': 'DescribeSubnets'}
    for subnet in aws.query(params, location=get_location(),
               provider=get_provider(), opts=__opts__, sigver='4'):
        tags = subnet.get('tagSet', {}).get('item', {})
        if not isinstance(tags, list):
            tags = [tags]
        for tag in tags:
            if tag['key'] == 'Name' and tag['value'] == subnetname:
                log.debug(
                    'AWS Subnet ID of %s is %s',
                    subnetname, subnet['subnetId']
                )
                return subnet['subnetId']
    return None