def METHOD_NAME(arg):
    """
    Modify arguments to make them compatible with Brian 1.
    - Arrays of units are replaced with straight arrays
    - Single values are replaced with Brian 1 equivalents
    - Slices are handled so we can use e.g. sound[:20*ms]
    The second part was necessary because some functions/classes test if an object is an array or not to see if it
    is a sequence, but because brian2.Quantity derives from ndarray this was causing problems.
    """
    if isinstance(arg, Quantity):
        if len(arg.shape) == 0:
            arg = b1.Quantity.with_dimensions(float(arg), arg.dim._dims)
        else:
            arg = asarray(arg)
    elif isinstance(arg, slice):
        arg = slice(METHOD_NAME(arg.start), METHOD_NAME(arg.stop), METHOD_NAME(arg.step))
    return arg