def getImmediateChildren(obj, phobostypes=(), selected_only=False, include_hidden=False):
    """Returns all immediate children for a given object and phobostypes (if provided).
    Search can be limited to selected objects and non-hidden objects.

    Args:
      obj(bpy.types.Object): object to start search from.
      phobostypes(list of strings, optional): phobostypes to limit search to. (Default value = ()
      selected_only(bool., optional): True to find only selected children, else False. (Default value = False)
      include_hidden(bool., optional): True to include hidden objects, else False. (Default value = False)

    Returns:
      : list - Blender objects which are immediate children of obj.

    """
    return [
        child
        for child in obj.children
        if (child.phobostype in phobostypes if phobostypes else True)
        and (not child.hide_viewport or include_hidden)
        and (child.select_get() or not selected_only)
    ]