def just(value, length, fillerchar, direction='left'):
    if isinstance(value, str):
        _fillerchar = fillerchar.decode()
    elif isinstance(value, bytes):
        _fillerchar = fillerchar
    if direction == 'left':
        return value.rjust(length, _fillerchar)
    if direction == 'right':
            return value.ljust(length, _fillerchar)


def zpad(value, length):
    return just(value, length, b'\x00')


def zpad32(value):
    return just(value, 32, b'\x00')


def zpad_right(value, length):
    return just(value, length, b'\x00', direction='right')


def zpad32_right(value):
    return just(value, 32, b'\x00', direction='right')


def fpad(value, length):
    return just(value, length, b'\xff')


def fpad32(value):
    return just(value, 32, b'\xff')

from cytoolz import (
    curry,
)


@curry
def zpad(value, length):
    return value.rjust(length, b'\x00')


zpad32 = zpad(length=32)


@curry
def zpad_right(value, length):
    return value.ljust(length, b'\x00')


zpad32_right = zpad_right(length=32)


@curry
def fpad(value, length):
    return value.rjust(length, b'\xff')


fpad32 = fpad(length=32)

change how padding utils are written