def _align_method_FRAME(left, right, axis):
def to_series(right):<EOL><INDENT>msg = ('<STR_LIT>'<EOL>'<STR_LIT>')<EOL>if axis is not None and left._get_axis_name(axis) == '<STR_LIT:index>':<EOL><INDENT>if len(left.index) != len(right):<EOL><INDENT>raise ValueError(msg.format(req_len=len(left.index),<EOL>given_len=len(right)))<EOL><DEDENT>right = left._constructor_sliced(right, index=left.index)<EOL><DEDENT>else:<EOL><INDENT>if len(left.columns) != len(right):<EOL><INDENT>raise ValueError(msg.format(req_len=len(left.columns),<EOL>given_len=len(right)))<EOL><DEDENT>right = left._constructor_sliced(right, index=left.columns)<EOL><DEDENT>return right<EOL><DEDENT>if isinstance(right, np.ndarray):<EOL><INDENT>if right.ndim == <NUM_LIT:1>:<EOL><INDENT>right = to_series(right)<EOL><DEDENT>elif right.ndim == <NUM_LIT:2>:<EOL><INDENT>if right.shape == left.shape:<EOL><INDENT>right = left._constructor(right, index=left.index,<EOL>columns=left.columns)<EOL><DEDENT>elif right.shape[<NUM_LIT:0>] == left.shape[<NUM_LIT:0>] and right.shape[<NUM_LIT:1>] == <NUM_LIT:1>:<EOL><INDENT>right = np.broadcast_to(right, left.shape)<EOL>right = left._constructor(right,<EOL>index=left.index,<EOL>columns=left.columns)<EOL><DEDENT>elif right.shape[<NUM_LIT:1>] == left.shape[<NUM_LIT:1>] and right.shape[<NUM_LIT:0>] == <NUM_LIT:1>:<EOL><INDENT>right = to_series(right[<NUM_LIT:0>, :])<EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>"<EOL>"<STR_LIT>"<EOL>.format(req_shape=left.shape,<EOL>given_shape=right.shape))<EOL><DEDENT><DEDENT>elif right.ndim > <NUM_LIT:2>:<EOL><INDENT>raise ValueError('<STR_LIT>'<EOL>'<STR_LIT>'.format(dim=right.shape))<EOL><DEDENT><DEDENT>elif (is_list_like(right) and<EOL>not isinstance(right, (ABCSeries, ABCDataFrame))):<EOL><INDENT>right = to_series(right)<EOL><DEDENT>return right<EOL>
convert rhs to meet lhs dims if input is list, tuple or np.ndarray