def state2str(State):
    """
    Converts the dictionary representation of a state into the string representation of a state.
    If *State* is already of type string it is simply returned.

    **arguments**
        * *State* (dict): dictionary representation of state

    **returns**
        * *State* (str): string representation of state

    **example**::

        >>> state = {"v2":0, "v1":1, "v3":1}
        >>> state2str(primes, state)
        '101'
    """
    
    if type(State) == str:
        return State
    
    return ''.join([str(State[x]) for x in sorted(State)])