<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def load(cls, path, vocab=None, dtype=np.float32, max_vocab=None, format=None, binary=False):
 """ Load pretrained word embedding from a file. Args: path (str):
 Path of file to load. vocab (str or None):
 Path to vocabulary file created by word2vec with ``-save-vocab <file>`` option. If vocab is given, :py:attr:`~vectors` and :py:attr:`~vocab` is ordered in descending order of frequency. dtype (numpy.dtype):
 Element data type to use for the array. max_vocab (int):
 Number of vocabulary to read. format (str or None):
 Format of the file. ``'word2vec'`` for file that was implemented in `word2vec <https://code.google.com/archive/p/word2vec/>`_, by Mikolov et al.. ``'glove'`` for file that was implemented in `GloVe <https://nlp.stanford.edu/projects/glove/>`_, Global Vectors for Word Representation, by Jeffrey Pennington, Richard Socher, Christopher D. Manning from Stanford NLP group. If ``None`` is given, the format is guessed from the content. binary (bool):
 Load file as binary file as in word embedding file created by `word2vec <https://code.google.com/archive/p/word2vec/>`_ with ``-binary 1`` option. If ``format`` is ``'glove'`` or ``None``, this argument is simply ignored Returns: :class:`~word_embedding_loader.word_embedding.WordEmbedding` """

        freqs = None
        if vocab is not None:
            with open(vocab, mode='rb') as f:
                freqs = loader.vocab.load_vocab(f)
            # Create vocab from freqs
            # [:None] gives all the list member
            vocab = {k: i for i, (k, v) in enumerate(
                     sorted(six.iteritems(freqs),
                            key=lambda k_v: k_v[1], reverse=True)[:max_vocab])}

        with open(path, mode='rb') as f:
            if format is None:
                mod = classify_format(f)
            else:
                mod = _select_module(format, binary)

        with open(path, mode='rb') as f:
            if vocab is not None:
                arr = mod.loader.load_with_vocab(f, vocab, dtype=dtype)
                v = vocab
            else:
                arr, v = mod.loader.load(f, max_vocab=max_vocab, dtype=dtype)

        obj = cls(arr, v, freqs)
        obj._load_cond = mod
        return obj