def safe_octal(octal_value):
 try:
  return oct(octal_value)
 except TypeError:
  return str(octal_value)

def safe_octal ( octal_value ) : try : return oct ( octal_value ) except TypeError : return str ( octal_value )
safe_octal -> octal value in string this correctly handles octal values specified as a string or as a numeric .