def binExpend(bnum: str, width: int) -> str:
    """Expand binary value to specified size. """
    if not width: width = len(bnum)
    if bnum[0] == '1':
        return '0' * (width - len(bnum)) + bnum
    return bnum[0] * (width - len(bnum)) + bnum