if this is a US county, use the qs:a2_alt for county eg - wof:name = 'Lancaster' and qs:a2_alt = 'Lancaster County', use latter
322628
function getName(wofData) {
  if (isUsCounty(wofData)) {
    return wofData.properties['qs:a2_alt'];
  }

  if (wofData.properties.hasOwnProperty('wof:label')) {
    return wofData.properties['wof:label'];
  }

  return wofData.properties['wof:name'];

}
679428
def _conv_adr(adr, entry):
        """"""
        if adr.value.street:
            entry['address'] = adr.value.street
        if adr.value.extended:
            entry['address2'] = adr.value.extended
        if adr.value.city:
            entry['city'] = adr.value.city
        if adr.value.region:
            entry['state'] = adr.value.region
        if adr.value.code and adr.value.code != '0':
            entry['zip'] = adr.value.code
        if adr.value.country:
            entry['country'] = adr.value.country
811080
def _iname2qname(self, iname: InstanceName) -> QualName:
        
        p, s, loc = iname.partition(":")
        return (loc, p) if s else (p, self.ns)
1019114
def wc_names(self):
        """"""
        if self.wc_name is None:
            res = set()
        else:
            res = set([self.wc_name])
        if self.args is not None:
            for arg in self.args:
                if isinstance(arg, Pattern):
                    res.update(arg.wc_names)
        if self.kwargs is not None:
            for val in self.kwargs.values():
                if isinstance(val, Pattern):
                    res.update(val.wc_names)
        return res
1143289
def _format_name_map(self, lon, lat):
        '''  '''

        if self.ppd in [4, 16, 64, 128]:
            lolaname = '_'.join(['LDEM', str(self.ppd)])
        elif self.ppd in [512]:
            lolaname = '_'.join(
                ['LDEM', str(self.ppd), lat[0], lat[1], lon[0], lon[1]])
        return lolaname
1013764
def _joinedQnames(self, _list):
        """"""
        try:
            s = "; ".join([p.qname for p in _list])
        except:
            s = "; ".join([p for p in _list])
        return s
975451
private static void checkName(String zoneId) {
        int n = zoneId.length();
        if (n < 2) {
           throw new DateTimeException("Invalid ID for region-based ZoneId, invalid format: " + zoneId);
        }
        for (int i = 0; i < n; i++) {
            char c = zoneId.charAt(i);
            if (c >= 'a' && c <= 'z') continue;
            if (c >= 'A' && c <= 'Z') continue;
            if (c == '/' && i != 0) continue;
            if (c >= '0' && c <= '9' && i != 0) continue;
            if (c == '~' && i != 0) continue;
            if (c == '.' && i != 0) continue;
            if (c == '_' && i != 0) continue;
            if (c == '+' && i != 0) continue;
            if (c == '-' && i != 0) continue;
            throw new DateTimeException("Invalid ID for region-based ZoneId, invalid format: " + zoneId);
        }
    }
988945
def __fieldNorm(self, fieldName):
        """"""
        if len(fieldName) > 11: fieldName = fieldName[:11]
        fieldName = fieldName.upper()
        fieldName.replace(' ', '_')
845046
function renameValue(item, rawName) {
  var trimmedName = rawName.trim();
  if (item.cleanFootnotes) {
    var length = trimmedName.length;
    if (
      trimmedName.indexOf("(") === length - 3 &&
      trimmedName.indexOf(")") === length - 1
    ) {
      return trimmedName.slice(0, length - 3);
    }
  }
  return trimmedName;
}
1278687
def to_s(format = :default)
      title_suffix = " (#{title})" if has_title?
      formatted_name = "#{family_name.upcase}, #{given_name}#{title_suffix}"
      formatted_nhs_number = " (#{nhs_number})" if nhs_number.present?
      case format
      when :default then formatted_name
      when :long then "#{formatted_name}#{formatted_nhs_number}"
      else full_name
      end
    end
15461
def _format_name_map(self, lonc, latc):
        '''  '''

        return '_'.join(['WAC', 'GLOBAL'] +
                        ['E' + latc + lonc, "{0:0>3}".format(self.ppd) + 'P'])
880732
def is_valid_field_name(value):
    """"""
    leftovers = re.sub(r"\w", "", value)
    leftovers = re.sub(r"-", "", leftovers)
    if leftovers != "" or value[0].isdigit() or value[0] in ["-", "_"] or " " in value:
        return False
    return True
491930
def _get_jsmap_name(self, url):
        """"""
        
        ret = urlopen(url)
        return ret.read().decode('utf-8').split('=')[0].replace(" ", "")
1310489
def to_match(self):
        """"""
        self.validate()

        mark_name, field_name = self.location.get_location_name()
        validate_safe_string(mark_name)

        if field_name is None:
            return u'$matched.%s' % (mark_name,)
        else:
            validate_safe_string(field_name)
            return u'$matched.%s.%s' % (mark_name, field_name)
385041
def _qname(self, name):
        
        if isinstance(name, QName):
            return name
        if not isinstance(name, str):
            raise TypeError("{} must be str".format(name))
        if name == '':
            return name
        if name.startswith('{'):
            return name
        prefix, tag = name.split(':', maxsplit=1)
        uri = self.NS[prefix]
        return QName(uri, tag)
968800
static String nameConvert(String name, boolean mapCamelCaseToUnderscore) {
    if (!mapCamelCaseToUnderscore)
      return name;
    StringBuilder sbd = new StringBuilder();
    char prevChar = name.charAt(0);
    sbd.append(Character.toLowerCase(prevChar));
    for (int i = 1, len = name.length(); i < len; i++) {
      char c = name.charAt(i);
      if (Character.isUpperCase(c)) {
        int next = i + 1;
        char nextChar = (next < len) ? name.charAt(next) : '\0';
        if (Character.isLowerCase(prevChar) || Character.isLowerCase(nextChar)) {
          sbd.append('_');
        }
        sbd.append(Character.toLowerCase(c));
      } else {
        sbd.append(c);
      }
      prevChar = c;
    }
    return sbd.toString();
  }
1288479
def format_who_when(fields):
    """"""
    offset = fields[3]
    if offset < 0:
        offset_sign = b'-'
        offset = abs(offset)
    else:
        offset_sign = b'+'
    offset_hours = offset // 3600
    offset_minutes = offset // 60 - offset_hours * 60
    offset_str = offset_sign + ('%02d%02d' % (offset_hours, offset_minutes)).encode('ascii')
    name = fields[0]

    if name == b'':
        sep = b''
    else:
        sep = b' '

    name = utf8_bytes_string(name)

    email = fields[1]

    email = utf8_bytes_string(email)

    return b''.join((name, sep, b'<', email, b'> ', ("%d" % fields[2]).encode('ascii'), b' ', offset_str))