def _get_gecos(name):
 try:
  gecos_field = pwd.getpwnam(name).pw_gecos.split(',', 3)
 except KeyError:
  raise CommandExecutionError("User '{0}' does not exist".format(name))
 if (not gecos_field):
  return {}
 else:
  while (len(gecos_field) < 4):
   gecos_field.append('')
  return {'fullname': locales.sdecode(gecos_field[0]), 'roomnumber': locales.sdecode(gecos_field[1]), 'workphone': locales.sdecode(gecos_field[2]), 'homephone': locales.sdecode(gecos_field[3])}

def _get_gecos ( name ) : try : gecos_field = pwd . getpwnam ( name ) . pw_gecos . split ( ',' , 3 ) except KeyError : raise CommandExecutionError ( "User '{0}' does not exist" . format ( name ) ) if ( not gecos_field ) : return { } else : while ( len ( gecos_field ) < 4 ) : gecos_field . append ( '' ) return { 'fullname' : locales . sdecode ( gecos_field [ 0 ] ) , 'roomnumber' : locales . sdecode ( gecos_field [ 1 ] ) , 'workphone' : locales . sdecode ( gecos_field [ 2 ] ) , 'homephone' : locales . sdecode ( gecos_field [ 3 ] ) }
retrieve gecos field info and return it in dictionary form .