def pad(string: str, length: int, character: str = " ", align: str = "right"):
    """
    Pads a string value with repeated instances of a character
    up to a specified length. If character is not specified, a
    space (‘ ‘) is used. By default, padding is added to the end
    of a string. An optional align parameter specifies if padding
    should be added to the 'left' (beginning), 'center', or
    'right' (end) of the input string.
    """
    string = str(string)
    character = str(character)
    npad = int(length) - len(string)
    if npad <= 0:
        return string
    elif align == "left":
        return npad * character + string
    elif align == "center":
        return (npad // 2) * character + string + (npad - npad // 2) * character
    else:
        return string + npad * character