<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def clean_picture(self):
 """ Validates format and file size of uploaded profile picture. """

        if self.cleaned_data.get('picture'):
            picture_data = self.cleaned_data['picture']
            if 'error' in picture_data:
                raise forms.ValidationError(_(u'Upload a valid image. '
                            'The file you uploaded was either not an image '
                            'or a corrupted image.'))
                
            content_type = picture_data.content_type
            if content_type:
                main, sub = content_type.split('/')
                if not (main == 'image' 
                            and sub in defaults.ACCOUNTS_PICTURE_FORMATS):
                    raise forms.ValidationError(_(u'%s only.' % 
                                    defaults.ACCOUNTS_PICTURE_FORMATS))
        
            if picture_data.size > int(defaults.ACCOUNTS_PICTURE_MAX_FILE):
                raise forms.ValidationError(_(u'Image size is too big.'))
            return self.cleaned_data['picture']