Convert integers to a list of integers to fit the number of dimensions if
    the argument is not already a list.

    For example:
    `dimensionize(3, nd=2)`
        will produce the following result:
        `(3, 3)`.
    `dimensionize([3, 1], nd=2)`
        will produce the following result:
        `[3, 1]`.

    For more information, refer to:
    - https://github.com/guillaume-chevalier/python-conv-lib/blob/master/conv/conv.py
    - https://github.com/guillaume-chevalier/python-conv-lib
    - MIT License, Copyright (c) 2018 Guillaume Chevalier

def dimensionize(maybe_a_list, nd=2):
    """Convert integers to a list of integers to fit the number of dimensions if
    the argument is not already a list.

    For example:
    `dimensionize(3, nd=2)`
        will produce the following result:
        `(3, 3)`.
    `dimensionize([3, 1], nd=2)`
        will produce the following result:
        `[3, 1]`.

    For more information, refer to:
    - https://github.com/guillaume-chevalier/python-conv-lib/blob/master/conv/conv.py
    - https://github.com/guillaume-chevalier/python-conv-lib
    - MIT License, Copyright (c) 2018 Guillaume Chevalier
    """
    if not hasattr(maybe_a_list, '__iter__'):
        # Argument is probably an integer so we map it to a list of size `nd`.
        now_a_list = [maybe_a_list] * nd
        return now_a_list
    else:
        # Argument is probably an `nd`-sized list.
        return maybe_a_list