docs: def load_with_vocab(fin, vocab, dtype=np.float32):
      """
      Load word embedding file with predefined vocabulary
  
      Args:
          fin (File): File object to read. File should be open for reading ascii.
          vocab (dict): Mapping from words (``bytes``) to vector indices
              (``int``).
          dtype (numpy.dtype): Element data type to use for the array.
  
      Returns:
          numpy.ndarray: Word embedding representation vectors
      """
      arr = None
      for line in fin:
          try:
              token, v = _parse_line(line, dtype)
          except (ValueError, IndexError):
              raise ParseError(b'Parsing error in line: ' + line)
          if token in vocab:
              if arr is None:
                  arr = np.empty((len(vocab), len(v)), dtype=dtype)
                  arr.fill(np.NaN)
              elif arr.shape[1] != len(v):
                  raise ParseError(b'Vector size did not match in line: ' + line)
              arr[vocab[token], :] = np.array(v, dtype=dtype).reshape(1, -1)
      return arr