def subspace2dict(Primes, Subspace):
    """
    Converts the string representation of a subspace into the dictionary representation of a subspace.
    Use "-" to indicate free variables.
    If *Subspace* is already of type *dict* it is simply returned.

    **arguments**
        * *Primes*: prime implicants or a list of names
        * *Subspace* (str): a subspace

    **returns**
        * *Subspace* (dict): the dictionary representation of subspace

    **example**::

        >>> sub = "-01"
        >>> subspace2dict(primes, sub)
        {'v2':0, 'v3':1}
    """
    
    if type(Subspace) == dict:
        assert (set(Subspace).issubset(set(Primes)))
        return Subspace
    
    assert (type(Subspace) == str)
    assert (len(Subspace) == len(Primes))
    
    return dict([(name, int(value)) for name, value in zip(sorted(Primes), Subspace) if not value == "-"])