def statedict2str(statedict):
    """Converts a state dictionary to a statestring using alphabetical sorting.

    Parameters
    ----------
    statedict : partial state dictionary
        State to convert to a binary string representation.

    Returns
    -------
    str
        A binary string, with each position corresponding
        to the variable name at the same position in the alphabetized keys in
        statedict.

    """
    return ''.join([str(statedict[x]) for x in sorted(statedict)])