def int_to_le_bytes(x: int, length: int, signed: bool) -> bytes:
    """Converts an integer to a little endian byte array.

    :param x: An integer to be mapped.
    :param length: Length of mapping output.
    :param signed: Flag indicating whether integer is signed.

    """
    if not isinstance(x, int):
        x = int(x)

    return bytes([i for i in x.to_bytes(length, 'little', signed=signed)])