docs: def read(file, system):
      """Parse an ANDES card file into internal variables"""
      try:
          fid = open(file, 'r')
          raw_file = fid.readlines()
      except IOError:
          print('* IOError while reading input card file.')
          return
  
      ret_dict = dict()
      ret_dict['outfile'] = file.split('.')[0].lower() + '.py'
      key, val = None, None
      for idx, line in enumerate(raw_file):
          line = line.strip()
          if not line:
              continue
          if line.startswith('#'):
              continue
          elif '#' in line:
              line = line.split('#')[0]
          if '=' in line:  # defining a field
              key, val = line.split('=')
              key, val = key.strip(), val.strip()
              val = [] if val == '' else val
              ret_dict.update({key: val})
              if val:
                  val = val.split(';')
          else:
              val.extend(line.split(';'))
          if val:
              val = de_blank(val)
              ret_dict[key] = val
  
      ret_dict_ord = dict(ret_dict)
  
      for key, val in ret_dict.items():
          if not val:
              continue
          if type(val) == list:
              if ':' in val[0]:
                  new_val = {}  # return in a dictionary
                  new_val_ord = [
                  ]  # return in an ordered list with the dict keys at 0
                  for item in val:
                      try:
                          m, n = item.split(':')
                      except ValueError:
                          print('* Error: check line <{}>'.format(item))
                          return
                      m, n = m.strip(), n.strip()
                      if ',' in n:
                          n = n.split(',')
                          n = de_blank(n)
                          n = [to_number(i) for i in n]
                      else:
                          n = to_number(n)
                      new_val.update({m.strip(): n})
                      new_val_ord.append([m.strip(), n])
                  ret_dict[key] = new_val
                  ret_dict_ord[key] = new_val_ord
  
      ret_dict['name'] = ret_dict['name'][0]
      ret_dict['doc_string'] = ret_dict['doc_string'][0]
      ret_dict['group'] = ret_dict['group'][0]
      ret_dict['service_keys'] = list(ret_dict['service_eq'].keys())
      ret_dict['consts'] = list(ret_dict['data'].keys()) + list(
          ret_dict['service_eq'].keys())
      ret_dict['init1_eq'] = ret_dict_ord['init1_eq']
      ret_dict['service_eq'] = ret_dict_ord['service_eq']
      ret_dict['ctrl'] = ret_dict_ord['ctrl']
  
      copy_algebs = []
      copy_states = []
      for item in ret_dict['ctrl']:
          key, val = item
          if val[3] == 'y':
              copy_algebs.append(key)
          elif val[3] == 'x':
              copy_states.append(key)
          elif val[3] == 'c':
              ret_dict['consts'].append(key)
      ret_dict['copy_algebs'] = copy_algebs
      ret_dict['copy_states'] = copy_states
  
      return run(system, **ret_dict)