def as_list(x):
    """ Try to convert argument to list and return it.

    Useful to implement function arguments that could be scalar values
    or lists.
    """
    try:
        return list(x)
    except TypeError:
        return list([x])