def parseSizeString(theSize):
    """Parses a size string into an integer byte value.
    """
    if not isinstance(theSize, str):
        return -1
    theBits = theSize.split()
    if len(theBits) == 1:
        try:
            return int(round(float(theBits[0])))
        except Exception:
            return -1
    elif len(theBits) > 1:
        if theBits[1].lower() == "kb":
            dScale = 1024
        elif theBits[1].lower() == "mb":
            dScale = 1024*1024
        elif theBits[1].lower() == "gb":
            dScale = 1024*1024*1024
        else:
            dScale = 1
        try:
            return int(round(float(theBits[0])*dScale))
        except Exception:
            return -1
    return -1