'Search for an object based on its player\'s name or dbref.
Args:
ostring (str or int): Search criterion or dbref. Searching
for a player is sometimes initiated by appending an `*` to
the beginning of the search criterion (e.g. in
local_and_global_search). This is stripped here.
exact (bool, optional): Require an exact player match.
candidates (list, optional): Only search among this list of possible
object candidates.
Return:
match (Object or list): One or more matching results.'

@returns_typeclass
def get_object_with_player(self, ostring, exact=True, candidates=None):

    ostring = to_unicode(ostring).lstrip('*')
    dbref = self.dbref(ostring)
    if dbref:
        return dbref
    cand_restriction = (((candidates is not None) and Q(pk__in=[_GA(obj, 'id') for obj in make_iter(candidates) if obj])) or Q())
    if exact:
        return self.filter((cand_restriction & Q(db_player__username__iexact=ostring)))
    else:
        ply_cands = self.filter((cand_restriction & Q(playerdb__username__istartswith=ostring))).values_list('db_key', flat=True)
        if candidates:
            index_matches = string_partial_matching(ply_cands, ostring, ret_index=True)
            return [obj for (ind, obj) in enumerate(make_iter(candidates)) if (ind in index_matches)]
        else:
            return string_partial_matching(ply_cands, ostring, ret_index=False)
