def transform(data_frame, **kwargs):
norm = kwargs.get('<STR_LIT>', <NUM_LIT:1.0>)<EOL>axis = kwargs.get('<STR_LIT>', <NUM_LIT:0>)<EOL>if axis == <NUM_LIT:0>:<EOL><INDENT>norm_vector = _get_norms_of_rows(data_frame, kwargs.get('<STR_LIT>', '<STR_LIT>'))<EOL><DEDENT>else:<EOL><INDENT>norm_vector = _get_norms_of_cols(data_frame, kwargs.get('<STR_LIT>', '<STR_LIT>'))<EOL><DEDENT>if '<STR_LIT>' in kwargs:<EOL><INDENT>if axis == <NUM_LIT:0>:<EOL><INDENT>return data_frame.apply(lambda col: col * norm / norm_vector, axis=<NUM_LIT:0>),kwargs['<STR_LIT>'].apply(lambda col: col * norm / norm_vector, axis=<NUM_LIT:0>)<EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if axis == <NUM_LIT:0>:<EOL><INDENT>return data_frame.apply(lambda col: col * norm / norm_vector, axis=<NUM_LIT:0>)<EOL><DEDENT>else:<EOL><INDENT>return data_frame.apply(lambda row: row * norm / norm_vector, axis=<NUM_LIT:1>)<EOL><DEDENT><DEDENT>
Return a transformed DataFrame.

Transform data_frame along the given axis. By default, each row will be normalized (axis=0).

Parameters
-----------
data_frame : DataFrame
    Data to be normalized.
axis : int, optional
    0 (default) to normalize each row, 1 to normalize each column.
method : str, optional
    Valid methods are:

    -  "vector" : Default for normalization by row (axis=0).
       Normalize along axis as a vector with norm `norm`
    -  "last" : Linear normalization setting last value along the axis to `norm`
    -  "first" : Default for normalization of columns (axis=1).
       Linear normalization setting first value along the given axis to `norm`
    -  "mean" : Normalize so that the mean of each vector along the given axis is `norm`
norm : float, optional
    Target value of normalization, defaults to 1.0.
labels : DataFrame, optional
    Labels may be passed as keyword argument, in which
    case the label values will also be normalized and returned.

Returns
-----------
df : DataFrame
    Normalized data.
labels : DataFrame, optional
    Normalized labels, if provided as input.

Notes
-----------
If labels are real-valued, they should also be normalized.

..
    Having row_norms as a numpy array should be benchmarked against 
    using a DataFrame:
    http://stackoverflow.com/questions/12525722/normalize-data-in-pandas
    Note: This isn't a bottleneck. Using a feature set with 13k rows and 256
    data_frame ('ge' from 1962 until now), the normalization was immediate.