def int_imf_dm(m1,m2,m,imf,bywhat='<STR_LIT>',integral='<STR_LIT>'):
ind_m = (m >= min(m1,m2)) & (m <= max(m1,m2))<EOL>if integral is '<STR_LIT>':<EOL><INDENT>int_func = sc.integrate.trapz<EOL><DEDENT>elif integral is '<STR_LIT>':<EOL><INDENT>int_func = sc.integrate.cumtrapz<EOL><DEDENT>else:<EOL><INDENT>print("<STR_LIT>")<EOL>return <NUM_LIT:0><EOL><DEDENT>if bywhat is '<STR_LIT>':<EOL><INDENT>return int_func(m[ind_m]*imf[ind_m],m[ind_m])<EOL><DEDENT>elif bywhat is '<STR_LIT>':<EOL><INDENT>return int_func(imf[ind_m],m[ind_m])<EOL><DEDENT>else:<EOL><INDENT>print("<STR_LIT>")<EOL>return <NUM_LIT:0><EOL><DEDENT>
Integrate IMF between m1 and m2.

Parameters
----------
m1 : float
    Min mass
m2 : float
    Max mass
m : float
    Mass array
imf : float
    IMF array
bywhat : string, optional
    'bymass' integrates the mass that goes into stars of
    that mass interval; or 'bynumber' which integrates the number
    of stars in that mass interval.  The default is 'bymass'.
integrate : string, optional
    'normal' uses sc.integrate.trapz; 'cum' returns cumulative
    trapezoidal integral.  The default is 'normal'.