def make_linked_methods(parent, o):
    """
    Generate 'magic' methods to fetch linked objects so that
    org = Organization(pd, 123)
    o.deals() # return an iterable list of deals
    o.files() # return an interable list of files
    """

    segment = o.RESOURCE_SEGMENT

    def linked_objects(**kw):
        # Define dynamic method
        if kw:
            return parent.list_linked_objects(o, **kw)
        else:
            return parent.list_linked_objects(o)

    linked_objects.__name__ = segment
    linked_objects.__doc__ = "Fetch %s linked to this %s" % (
        segment, parent.RESOURCE)

    return linked_objects