help with custom formatter rules

As related to another question(s) I’ve posted, can someone help with this custom formatter? This is for use in a FunctionFormatter to be used on the y axis to format the ticks (in particular, to remove them when not wanted). Example:

def CustomFormatter(self,y,i):
if y < 0:
return ‘’

This says if the value of y < 0, put nothing on the axis tick.

QUESTION: How can I implement the following two sorts of rules in Matplotlib’s (OO) API?

def CustomFormatter(self,y,i):
if y falls in the bottom 50 pixels’ worth of height of this plot:
return ‘’

or

def CustomFormatter(self,y,i):

    if y falls in the bottom 10% of the height of this plot:

        return ''

Thanks,
Che