Helper function to turn a name into an arn string,
    returns None if not able to resolve
973231
def _get_role_arn(name, **conn_params):
    '''
    
    '''
    if name.startswith('arn:aws:iam'):
        return name
    role = __salt__['boto_iam.describe_role'](name, **conn_params)
    rolearn = role.get('arn') if role else None

    return rolearn
1287371
def set_name(self,name=None):
        
        if name:
            self.name = name[:254]
        else:
            self.name = self.extract_name()[:254]

        self.save()

        return self.name
704162
async def substr(self, name, start, end=-1):
        
        return await self.execute_command('SUBSTR', name, start, end)
669072
def from_local_name(acs, attr, name_format):
    
    for aconv in acs:
        #print(ac.format, name_format)
        if aconv.name_format == name_format:
            #print("Found a name_form converter")
            return aconv.to_format(attr)
    return attr
684728
def format_name(net: str) -> str:
        ''''''

        if net.startswith('t') or 'testnet' in net:
            net = net[1:] + '-test'
        else:
            net = net

        return net
548404
def toStringArray(name, a, width = 0):
    
    string = name + ": "
    cnt = 0
    for i in a:
        string += "%4.2f  " % i 
        if width > 0 and (cnt + 1) % width == 0:
            string += '\n'
        cnt += 1
    return string
209729
def strlen(self, name):
        
        with self.pipe as pipe:
            return pipe.strlen(self.redis_key(name))
186673
function getName(str) {
	var name = path.basename(str);
	if (name.lastIndexOf('.') === -1) {
		name += '.json';
	}
	return name;
}
260304
def resolve_name(name, arch, osarch=None):
    '''
    
    '''
    if osarch is None:
        osarch = get_osarch()

    if not check_32(arch, osarch) and arch not in (ARCHMAP.get(osarch, osarch), 'noarch'):
        name += '.{0}'.format(arch)
    return name
161536
def first_arg_to_level_name(arg):
    """"""
    try:
        return int(arg)
    except ValueError:
        arg = arg.upper()
        for level in LEVELS:
            if level in arg:
                return level
        return None
787968
def name=(name)
      if name.nil?
        fail ArgumentError, "name cannot be nil"
      end

      if name !~ Regexp.new(/^(?!(.*[\\\"\\*\\\\\\>\\<\\?\/\\:\\|]+.*)|(.*[\\.]?.*[\\.]+$)|(.*[ ]+$))/)
        fail ArgumentError, "invalid value for 'name', must conform to the pattern /^(?!(.*[\\\"\\*\\\\\\>\\<\\?\/\\:\\|]+.*)|(.*[\\.]?.*[\\.]+$)|(.*[ ]+$))/."
      end

      @name = name
    end
175659
def with_name(self, name):
        """"""
        if not self.name:
            raise ValueError("%r has an empty name" % (self,))
        return self._from_parsed_parts(self._drv, self._root,
                                       self._parts[:-1] + [name])
805991
function normalizeName (name) {
  // Normalize directories as a single slash
  name = _(name).toString();
  if (_.isEmpty(name) || name === "/" || name === "//") {
    return "/";
  }

  // Add a leading slash
  if (!_.startsWith(name, "/")) {
    name = "/" + name;
  }

  // Don't allow slashes in the middle
  if (_.includes(name.substring(1, name.length - 1), "/")) {
    throw ono("Resource names cannot contain slashes");
  }

  return name;
}
1243432
def nmltostring(nml):
    """"""
    if not isinstance(nml,dict):
      raise ValueError("nml should be a dict !")

    curstr = ""
    for key,group in nml.items():
       namelist = ["&" + key]
       for k, v in group.items():
         if isinstance(v, list) or isinstance(v, tuple):
           namelist.append(k + " = " + ",".join(map(str, v)) + ",")
         elif is_string(v):
           namelist.append(k + " = '" + str(v) + "',")
         else:
           namelist.append(k + " = " + str(v) + ",")
       namelist.append("/")

       curstr = curstr + "\n".join(namelist) + "\n"

    return curstr
89517
def clone_name(s, ca=False):
    
    if not ca:
        return s[:-1]

    if s[0] == '1':
        return s[2:]
    return s.rstrip('ab')
1066581
def to_str(number):
    
    states = globals()
    for name, value in states.items():
        if number == value and name.isalpha() and name.isupper():
            return name
    return '(unknown state %d)' % number
621517
def convert_name(s):
    
    m = re.compile(r"^(.*)\.(.*)\((.*)\)(.*)  ::  (.*)$")
    res = m.search(s)
    if res:
        clname, methodname, all_args, ret, perm = res.groups()
        args = " ".join(map(name_to_androguard, all_args.split(",")))

        clname = name_to_androguard(clname)
        ret = name_to_androguard(ret)

        # perm is actually a comma separated list of permissions
        return "{}-{}-({}){}".format(clname, methodname, args, ret), perm.split(", ")
    else:
        raise ValueError("what?")