import warnings


def _get_join_params(func_kwargs):
    """Extract and return any join parameters."""
    # remove and save the join kw, if specified (so it doesn't interfere
    # with other operations and doesn't get sent to the function)
    join_type = func_kwargs.pop("join", None)
    if not join_type:
        return None, None, None
    left_on = func_kwargs.pop("left_on", None)
    right_on = func_kwargs.pop("right_on", None)
    if left_on and not right_on:
        warnings.warn(
            "If you are specifying explicit join keys "
            "you must specify 'right_on' parameter with the "
            + "name of the output column to join on. "
            + "Results will joined on index."
        )
    if not left_on:
        col_keys = list(func_kwargs.keys() - {"start", "end", "data"})
        if len(col_keys) == 1:
            # Only one input param so assume this is the src/left
            # join key
            left_on = func_kwargs.get(col_keys[0])

    if right_on and not left_on:
        warnings.warn(
            "Could not infer 'left' join column from source data. "
            + "Please specify 'left_on' parameter with the "
            + "name of the source column to join on. "
            + "Results will joined on index."
        )
    return join_type, left_on, right_on