import math


def ci_to_sd(lowerci, upperci, cival=95.0, size=100):
    """
    Converts Confidence interval to Mean and Standard deviation.
    Parameters:
        lowerci (float, required): The lower bound of the confidence
            interval.
        upperci (float, required): The upper bound of the confidence
            interval.
        cival (float, optional): The confidence level.
            It must be one of the following values.
            [99.9,99.5,99.0,95.0,90.0,85.0,80.0]
            The default value is 95 for 95% confidence interval.
        size (int, optional): The size of the sample to be generated.
            The default value is 100.
    Returns:
        float: A float value for Standard deviation.
    """
    zvals = {99.9:3.291, 99.5:2.807, 99.0:2.807, 95.0:1.960, 90.0:1.645, \
            85.0:1.645, 80.0:1.282}
    zscore = zvals[float(cival)]
    sdev = math.sqrt(size)*(upperci-lowerci)/zscore
    return sdev