parameters: (attr, camel_killer=False)
return_statement: return re.sub('_+', '_', out)
docstring: Convert a key into something that is accessible as an attribute
docstring_summary: Convert a key into something that is accessible as an attribute
docstring_tokens: Convert a key into something that is accessible as an attribute
function: def safe_attr(attr, camel_killer=False):
      """Convert a key into something that is accessible as an attribute"""
      allowed = string.ascii_letters + string.digits + '_'
  
      attr = _safe_key(attr)
  
      if camel_killer:
          attr = _camel_killer(attr)
  
      attr = attr.replace(' ', '_')
  
      out = ''
      for character in attr:
          out += character if character in allowed else "_"
      out = out.strip("_")
  
      try:
          int(out[0])
      except (ValueError, IndexError):
          pass
      else:
          out = '{}{}'.format(DEFAULT_STARTING_CHAR, out)
  
      if out in ILLEGAL_ATTRIBUTES:
          out = '{}{}'.format(DEFAULT_STARTING_CHAR, out)
  
      return re.sub('_+', '_', out)
function_tokens: def safe_attr ( attr , camel_killer = False ) : allowed = string . ascii_letters + string . digits + '_' attr = _safe_key ( attr ) if camel_killer : attr = _camel_killer ( attr ) attr = attr . replace ( ' ' , '_' ) out = '' for character in attr : out += character if character in allowed else "_" out = out . strip ( "_" ) try : int ( out [ 0 ] ) except ( ValueError , IndexError ) : pass else : out = '{}{}' . format ( DEFAULT_STARTING_CHAR , out ) if out in ILLEGAL_ATTRIBUTES : out = '{}{}' . format ( DEFAULT_STARTING_CHAR , out ) return re . sub ( '_+' , '_' , out )