'Escape a string for use in sed.'

def sedesc(self, value):

    def escchar(c):
        if (c in '/^.[]$()|*+?{}\\'):
            return ('\\' + c)
        else:
            return c
    return ''.join([escchar(c) for c in value])
