def make_cond_from_sel(selection):
    """Make an SQL condition string from a selection dictionary"""
    query = ''
    if 'start' in selection:
        query += 'end > ' + str(selection['start'])
        if selection.get('inclusion') == 'strict':
            query += ' and start >= ' + str(selection['start'])
    if 'end' in selection:
        if query:
            query += ' and '
        query += 'start < ' + str(selection['end'])
        if selection.get('inclusion') == 'strict':
            query += ' and end <= ' + str(selection['end'])
    if 'strand' in selection:
        if query:
            query += ' and '
        query += 'strand == ' + str(selection['strand'])
    if 'score' in selection:
        if not isinstance(selection['score'], tuple):
            raise Exception('Score intervals must be tuples of size 2')
        if query:
            query += ' and '
        query += 'score >= ' + str(selection['score'][0]
            ) + ' and score <= ' + str(selection['score'][1])
    return query
