Determines the input format based on the given country name

        Parameters
        ----------

        name : string

        Returns
        -------

        string : valid input format
559352
def _get_input_format_from_name(self, name):
        
        try:
            int(name)
            src_format = 'ISOnumeric'
        except ValueError:
            if len(name) == 2:
                src_format = 'ISO2'
            elif len(name) == 3:
                src_format = 'ISO3'
            else:
                src_format = 'regex'
        return src_format
1274206
def clean_text(self, country, guess=False, **kwargs):
        
        code = country.lower().strip()
        if code in self.names:
            return code
        country = countrynames.to_code(country, fuzzy=guess)
        if country is not None:
            return country.lower()
135104
def find_file_format(file_name):
        
        for file_format in Format.ALLOWED:
            file_path = '.'.join((file_name, file_format))
            if os.path.exists(file_path):
                return file_path, file_format
        return None, None
751817
public static function getFormatDefinition(string $name): ?string
    {
        if (!self::$formats) {
            self::$formats = self::initFormats();
        }

        return isset(self::$formats[$name]) ? self::$formats[$name] : null;
    }
1007604
def validate_aws_name(name):
  """"""
  assert len(name) <= 127
  # disallow unicode characters to avoid pain
  assert name == name.encode('ascii').decode('ascii')
  assert aws_name_regexp.match(name)
1220399
def from_format(self, attr):
        
        if attr.name_format:
            if self.name_format == attr.name_format:
                try:
                    return self._fro[attr.name.lower()]
                except KeyError:
                    pass
        else:  # don't know the name format so try all I have
            try:
                return self._fro[attr.name.lower()]
            except KeyError:
                pass

        return ""
1205195
def get_country_by_name(self, country_name) -> 'Country':
        
        VALID_STR.validate(country_name, 'get_country_by_name', exc=ValueError)
        if country_name not in self._countries_by_name.keys():
            for country in self.countries:

                if country.country_name == country_name:
                    return country
            raise ValueError(country_name)
        else:
            return self._countries_by_name[country_name]
1044787
public static ErrorCode isNameValid(String name) {
        if (!isMustFieldValid(name, nameRegEx)) {
            return ErrorCode.SERVICE_INSTANCE_NAME_FORMAT_ERROR;
        }
        return ErrorCode.OK;
    }
34141
private static String formatName( String name )
    {
        if ( name.length() < NAME_COL_WIDTH )
        {
            return name;
        }
        return name.substring( 0, NAME_COL_WIDTH - 1 ) + ">";
    }
1196481
def _parse_name(name):
    
    required = False

    if name[-1] == '*':
        name = name[0:-1]
        required = True

    return name, required
495412
def validate(value):
        
        if not helpers.has_len(value):
            return False

        return COUNTRIES.has_key(str(value).lower())
433543
def guessFormat(self, name):
        
        name = name.lower()
        generator = self.generator
        if re.findall(r'^is[_A-Z]', name): return lambda x:generator.boolean()
        if re.findall(r'(_a|A)t$', name): return lambda x:generator.dateTime()

        if name in ('first_name','firstname'): return lambda x: generator.firstName()
        if name in ('last_name','lastname'): return lambda x: generator.lastName()

        if name in ('username','login','nickname'): return lambda x:generator.userName()
        if name in ('email','email_address'): return lambda x:generator.email()
        if name in ('phone_number','phonenumber','phone'): return lambda x:generator.phoneNumber()
        if name == 'address' : return lambda x:generator.address()
        if name == 'city' : return lambda x: generator.city()
        if name == 'streetaddress' : return lambda x: generator.streetaddress()
        if name in ('postcode','zipcode'): return lambda x: generator.postcode()
        if name == 'state' : return lambda x: generator.state()
        if name == 'country' : return lambda x: generator.country()
        if name == 'title' : return lambda x: generator.sentence()
        if name in ('body','summary', 'description'): return lambda x: generator.text()
298098
def format_value(self, value):
        
        if value == '' or value is None:
            return None
        return formats.localize_input(value, self.format)
308874
function formatName(input, noCamelCase){
	input = input.replace(/^-+/, "");
	
	// Convert kebab-case to camelCase
	if(!noCamelCase && /-/.test(input))
		input = input.toLowerCase().replace(/([a-z])-+([a-z])/g, (_, a, b) => a + b.toUpperCase());
	
	return input;
}
1360940
static String formatName(String name)
   {
      return name == null ? null : name.replaceAll(" ", "").replaceAll("[,;]", ", ");
   }
766069
public static String validateCountry(String country) {
        if (country.length() > DEFAULT_COUNTRY_LEN) {
            return country.substring(0, DEFAULT_COUNTRY_LEN);
        }

        return country;
    }
179551
def is_valid_country_abbrev(abbrev, case_sensitive=False):
    
    if case_sensitive:
        country_code = abbrev
    else:
        country_code = abbrev.upper()

    for code, full_name in COUNTRY_TUPLES:
        if country_code == code:
            return True

    return False