@staticmethod
def _filter_by_regexp(job_list, regexp, attribute):
    """
        Return list of items in `job_list` whose attribute
        named `attribute` matches the supplied (non-anchored) regexp.

        Jobs that do not possess an attribute with the specified name do *not*
        match.
        """
    matching_jobs = []
    for job in job_list:
        try:
            attrvalue = getattr(job, attribute)
        except AttributeError:
            continue
        if regexp.search(attrvalue):
            matching_jobs.append(job)
    return matching_jobs
