<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _dim_attribute(self, attr, *args, **kwargs):
 """ Returns a list of dimension attribute attr, for the dimensions specified as strings in args. .. code-block:: python ntime, nbl, nchan = cube._dim_attribute('global_size', 'ntime', 'nbl', 'nchan') or .. code-block:: python ntime, nbl, nchan, nsrc = cube._dim_attribute('global_size', 'ntime,nbl:nchan nsrc') """


        import re

        # If we got a single string argument, try splitting it by separators
        if len(args) == 1 and isinstance(args[0], str):
            args = (s.strip() for s in re.split(',|:|;| ', args[0]))

        # Now get the specific attribute for each string dimension
        # Integers are returned as is
        result = [d if isinstance(d, (int, np.integer))
            else getattr(self._dims[d], attr) for d in args]

        # Return single element if length one and single else entire list
        return (result[0] if kwargs.get('single', True)
            and len(result) == 1 else result)