def get_time_delta_from_args(args, prefix, required=True):
    """
    Create an astropy.time.TimeDelta value from argument crated via time_delta_parser.

    :param args: The argument parser result
    :param prefix: the argument used.
    :param required:  Was this argument required?
    :return: An astropy.time.TimeDelta value
    """
    from astropy.time import TimeDelta
    prefix = prefix.replace('-', '_', -1)
    val_name = prefix
    val2_name = prefix + '_val2'
    format_name = prefix + '_format'
    scale_name = prefix + '_scale'
    val = getattr(args, prefix)
    val2 = getattr(args, val2_name)
    format_ = getattr(args, format_name)
    scale = getattr(args, scale_name)
    if required and not val:
        raise SystemExit('missing argument %s' % val_name)
    if (val2 or format_) and not val:
        raise SystemExit('%s or %s cannot be used without %s' % (val2_name,
            format_name, val_name))
    if val:
        return TimeDelta(val, val2, format=format_, scale=scale)
    return None
