<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _pad(expr, width, side='left', fillchar=' '):
 """ Pad strings in the sequence or scalar with an additional character to specified side. :param expr: :param width: Minimum width of resulting string; additional characters will be filled with spaces :param side: {‘left’, ‘right’, ‘both’}, default ‘left’ :param fillchar: Additional character for filling, default is whitespace :return: sequence or scalar """


    if not isinstance(fillchar, six.string_types):
        msg = 'fillchar must be a character, not {0}'
        raise TypeError(msg.format(type(fillchar).__name__))

    if len(fillchar) != 1:
        raise TypeError('fillchar must be a character, not str')

    if side not in ('left', 'right', 'both'):
        raise ValueError('Invalid side')

    return _string_op(expr, Pad, _width=width, _side=side, _fillchar=fillchar)