def resolve_job_range(ids):
    """Resolve ranges from a list of ids. Given list of id strings
    can contain ranges separated with '-'. For example, '1-10' will
    result in a range from 1..10.

    :param ids: string or list of strings of ids
    :type ids: string or list of strings
    :returns: resolved list of ids
    :rtype: list of integers
    :raises ValueError: if on of the ids could not be converted to a valid,
                        positive id
    """
    if not isinstance(ids, (list, tuple)):
        ids = [ids]
    r = []

    def to_id(i):
        try:
            v = int(i)
            if v < 0:
                raise ValueError("Job ids have to be >= 0!")
            return v
        except:
            raise ValueError("Unable to convert '%s' to a job id. A valid"
                             " job id has to be a number" % i)
    for i in ids:
        s = i.split("-")
        if len(s) == 1:
            r.append(to_id(i))
        elif len(s) == 2:
            start = to_id(s[0])
            end = to_id(s[1])
            start, end = min(start, end), max(start, end)
            r.extend(range(start, end + 1))
        else:
            raise ValueError("Unable to guess a job range from %s" % i)
    return r