def parse_where(where, prefix):
    """Helper method to parse a dict to SQL where clause query

    Parameters
    ----------
    where : dict (key, value)
        Key may be field name optionally appended with filtering operator:
      name_eq 	  be equal to the value
      name_ne     be equal to the value
      name_lt     less than the value
      name_le     less than or equal to the value
      name_gt     greater than the value
      name_ge     greater than or equal to the value
      name_in     be included in the value
      name_notin  not be included in the value
    prefix : str in {'AND','WHERE'}
        Whether this is continuation of a longer where clause
    """
    def parse(name, value):
        """helper method to process filtering operator, if any"""
        if name.endswith('_eq'):
            return f"{name[:-3]} = '{value}'"
        elif name.endswith('_ne'):
            return f"{name[:-3]} != '{value}'"
        elif name.endswith('_le'):
            return f"{name[:-3]} <= '{value}'"
        elif name.endswith('_lt'):
            return f"{name[:-3]} < '{value}'"
        elif name.endswith('_ge'):
            return f"{name[:-3]} >= '{value}'"
        elif name.endswith('_gt'):
            return f"{name[:-3]} > '{value}'"
        elif name.endswith('_in'):
            value = "','".join(value)
            return f"{name[:-3]} in ('{value}')"
        elif name.endswith('_notin'):
            value = "','".join(value)
            return f"{name[:-6]} not in ('{value}')"
        else:
            return f"{name} = '{value}'"            
    if where:
        if isinstance(where, dict):
            where = " AND ".join(f"{parse(k, v)}'" for k,v in where.items())
        return " " + prefix + " " + where
    return ''