def toList(buffer):
    """
    Takes a list, bytes object or string and converts it to a list
    of integers.

    Args:
        buffer: A list, bytes object or string.

    Returns:
        A list of integers.
    """
    if isinstance(buffer, str):
        return [ord(ch) for ch in buffer]
    else:
        return [int(val) for val in buffer]