<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def directly_related(obj, count, collected_so_far, mods=[], only_from_same_site=True):
 """ Returns objects related to ``obj`` up to ``count`` by searching ``Related`` instances for the ``obj``. """

    # manually entered dependencies
    qset = Related.objects.filter(publishable=obj)

    if mods:
        qset = qset.filter(related_ct__in=[
            ContentType.objects.get_for_model(m).pk for m in mods])

    return get_cached_objects(qset.values_list('related_ct', 'related_id')[:count], missing=SKIP)